I tried the pypy hack for gevent. My pypy prgram (flask with sse) starts. But when I try to connect I get the following error:
Traceback (most recent call last):
File "build/bdist.linux-armv6l/egg/gevent/greenlet.py", line 328, in run
result = self._run(_self.args, *_self.kwargs)
File "build/bdist.linux-armv6l/egg/gevent/pywsgi.py", line 653, in handle
handler = self.handler_class(socket, address, self)
File "build/bdist.linux-armv6l/egg/gevent/pywsgi.py", line 175, in init
self.rfile = socket.makefile('rb', -1)
File "build/bdist.linux-armv6l/egg/gevent/socket.py", line 379, in makefile
return _fileobject(type(self)(_sock=self), mode, bufsize)
File "/usr/lib/pypy-upstream/lib-python/2.7/socket.py", line 300, in init
sock._reuse()
AttributeError: 'socket' object has no attribute '_reuse'
<Greenlet at 0x4737a10L: <bound method WSGIServer.handle of <WSGIServer at 0x465d630L fileno=6 address=0.0.0.0:9999>>(<socket at 0x4737a30L fileno=8 sock=192.168.1.199:, ('84.63.102.205', 52661))> failed with AttributeError
PyPy note about refcounting: implemented with _reuse()/_drop()
on the class '_socket.socket'. Python 3 did it differently
with a reference counter on this class 'socket._socketobject'
instead, but it is a less compatible change.
Note that a few libraries (like eventlet) poke at the
private implementation of socket.py, passing custom
objects to _socketobject(). These libraries need the
following fix for use on PyPy: the custom objects need
methods _reuse() and _drop() that maintains an explicit
reference counter, starting at 0. When it drops back to
zero, close() must be called.
And a comment from the pypy-dev mailing list with an interesting link:
"No, this isn't a bug in PyPy. If gevent wants to use the internal details of
the socket module in way's that aren't defined, they need to pass somethign
which matches the required interface.
it's worth noting that eventlet had the same issue, and it was fixed here (thanks to... Alex :)):
I tried the pypy hack for gevent. My pypy prgram (flask with sse) starts. But when I try to connect I get the following error:
Traceback (most recent call last): File "build/bdist.linux-armv6l/egg/gevent/greenlet.py", line 328, in run result = self._run(_self.args, *_self.kwargs) File "build/bdist.linux-armv6l/egg/gevent/pywsgi.py", line 653, in handle handler = self.handler_class(socket, address, self) File "build/bdist.linux-armv6l/egg/gevent/pywsgi.py", line 175, in init self.rfile = socket.makefile('rb', -1) File "build/bdist.linux-armv6l/egg/gevent/socket.py", line 379, in makefile return _fileobject(type(self)(_sock=self), mode, bufsize) File "/usr/lib/pypy-upstream/lib-python/2.7/socket.py", line 300, in init sock._reuse() AttributeError: 'socket' object has no attribute '_reuse' <Greenlet at 0x4737a10L: <bound method WSGIServer.handle of <WSGIServer at 0x465d630L fileno=6 address=0.0.0.0:9999>>(<socket at 0x4737a30L fileno=8 sock=192.168.1.199:, ('84.63.102.205', 52661))> failed with AttributeError
I found a comment which may help here: https://mail.python.org/pipermail/pypy-commit/2013-August/076563.html
PyPy note about refcounting: implemented with _reuse()/_drop()
on the class '_socket.socket'. Python 3 did it differently
with a reference counter on this class 'socket._socketobject'
instead, but it is a less compatible change.
Note that a few libraries (like eventlet) poke at the
private implementation of socket.py, passing custom
objects to _socketobject(). These libraries need the
following fix for use on PyPy: the custom objects need
methods _reuse() and _drop() that maintains an explicit
reference counter, starting at 0. When it drops back to
zero, close() must be called.
And a comment from the pypy-dev mailing list with an interesting link:
"No, this isn't a bug in PyPy. If gevent wants to use the internal details of the socket module in way's that aren't defined, they need to pass somethign which matches the required interface.
it's worth noting that eventlet had the same issue, and it was fixed here (thanks to... Alex :)):
https://github.com/eventlet/eventlet/commit/2633322d6581beacd39d832284f17d461eb25098 "