Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
c3148641
Commit
c3148641
authored
Feb 05, 2011
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup FileWrapper.__del__ a little
parent
7d801b21
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
fs/filelike.py
+8
-7
No files found.
fs/filelike.py
View file @
c3148641
...
@@ -618,11 +618,11 @@ class FileWrapper(FileLikeBase):
...
@@ -618,11 +618,11 @@ class FileWrapper(FileLikeBase):
# Close the wrapper and the underlying file independently, so the
# Close the wrapper and the underlying file independently, so the
# latter is still closed on cleanup even if the former errors out.
# latter is still closed on cleanup even if the former errors out.
try
:
try
:
super
(
FileWrapper
,
self
)
.
close
()
if
FileWrapper
is
not
None
:
except
Exception
:
super
(
FileWrapper
,
self
)
.
close
()
finally
:
if
hasattr
(
getattr
(
self
,
"wrapped_file"
,
None
),
"close"
):
if
hasattr
(
getattr
(
self
,
"wrapped_file"
,
None
),
"close"
):
self
.
wrapped_file
.
close
()
self
.
wrapped_file
.
close
()
raise
def
close
(
self
):
def
close
(
self
):
"""Close the object for reading/writing."""
"""Close the object for reading/writing."""
...
@@ -631,10 +631,11 @@ class FileWrapper(FileLikeBase):
...
@@ -631,10 +631,11 @@ class FileWrapper(FileLikeBase):
# close() on it, which will call its flush() again! To avoid
# close() on it, which will call its flush() again! To avoid
# this inefficiency, our flush() will not flush the wrapped
# this inefficiency, our flush() will not flush the wrapped
# file when we're closing.
# file when we're closing.
self
.
__closing
=
True
if
not
self
.
closed
:
super
(
FileWrapper
,
self
)
.
close
()
self
.
__closing
=
True
if
hasattr
(
self
.
wrapped_file
,
"close"
):
super
(
FileWrapper
,
self
)
.
close
()
self
.
wrapped_file
.
close
()
if
hasattr
(
self
.
wrapped_file
,
"close"
):
self
.
wrapped_file
.
close
()
def
flush
(
self
):
def
flush
(
self
):
"""Flush the write buffers of the file."""
"""Flush the write buffers of the file."""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment