Commit 5657ffe9 authored by Jason Madden's avatar Jason Madden

Tweaks to FileObjectThread._do_close to break reference cycles in the event of an exception.

parent 9b87786b
......@@ -227,12 +227,18 @@ class FileObjectThread(FileObjectBase):
# the existing race condition any worse.
# We wrap the close in an exception handler and re-raise directly
# to avoid the (common, expected) IOError from being logged by the pool
def close():
def close(_fobj=fobj):
try:
fobj.close()
_fobj.close()
except: # pylint:disable=bare-except
return sys.exc_info()
finally:
_fobj = None
del fobj
exc_info = self.threadpool.apply(close)
del close
if exc_info:
reraise(*exc_info)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment