greenio: makefile related pypy socket ref counting
On PyPy `[Errno 9] Bad file descriptor` because `makefile dup/_drop` dance leaves socket with PyPy special reference counter zero, so it may be garbage collected. https://github.com/eventlet/eventlet/issues/318 (@temoto) maybe proper fix is to remove `dup` in `makefile()`.
This commit is contained in:
committed by
Sergey Shepelev
parent
6de8d478ca
commit
2ea3ad9c22
@@ -299,6 +299,11 @@ class GreenSocket(object):
|
||||
res = _python2_fileobject(dupped, *args, **kwargs)
|
||||
if hasattr(dupped, "_drop"):
|
||||
dupped._drop()
|
||||
# Making the close function of dupped None so that when garbage collector
|
||||
# kicks in and tries to call del, which will ultimately call close, _drop
|
||||
# doesn't get called on dupped twice as it has been already explicitly called in
|
||||
# previous line
|
||||
dupped.close = None
|
||||
return res
|
||||
|
||||
def makeGreenFile(self, *args, **kw):
|
||||
|
||||
Reference in New Issue
Block a user