Skip to content

Commit

Permalink
Clean up TypeError in __del__
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tipabu committed Sep 30, 2020
1 parent 7f03295 commit f2ebbb8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion eventlet/greenio/py2.py
Expand Up @@ -207,7 +207,10 @@ def _close(self):
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:
Expand Down

0 comments on commit f2ebbb8

Please sign in to comment.