summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2020-09-28 16:30:06 -0700
committerTim Burke <tim.burke@gmail.com>2020-09-29 17:48:46 -0700
commitf2ebbb87590d0fa4f173599806dfec88caeb9fb9 (patch)
tree5c00dd43e05741848dbb020bf0c198b937e8f629
parent7f03295741bdc2c8b8294ca513f1ee5e644a74a5 (diff)
downloadeventlet-f2ebbb87590d0fa4f173599806dfec88caeb9fb9.tar.gz
Clean up TypeError in __del__
At the end of the py2 tests, we would see (ignored) errors like Exception TypeError: "'NoneType' object is not callable" in <bound method _SocketDuckForFd.__del__ of _SocketDuckForFd:14> ignored
-rw-r--r--eventlet/greenio/py2.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/eventlet/greenio/py2.py b/eventlet/greenio/py2.py
index 20338aa..74d2ff5 100644
--- a/eventlet/greenio/py2.py
+++ b/eventlet/greenio/py2.py
@@ -207,7 +207,10 @@ class _SocketDuckForFd(object):
was_closed = self._mark_as_closed()
if was_closed:
return
- notify_close(self._fileno)
+ if notify_close:
+ # If closing from __del__, notify_close may have
+ # already been cleaned up and set to None
+ notify_close(self._fileno)
try:
os.close(self._fileno)
except: