I'm porting gevent to pure python, removing cython and replacing it with ctypes. I have gevent now importing into PyPy, but i'm stuck at the greenlet error below. To test this, just "hg clone" these two repos, no install required (you need to compile and install libev.so yourself).
http://code.google.com/p/pyev-ctypes/http://code.google.com/r/brett-gevent-ctypes/for core.py to find pyev-ctypes it expects pyev-ctypes to be at the same directory level as brett-gevent-ctypes
cd to examples and run ctypes-helloworld.py
I'm new to greenlet, so i'm not sure what is going wrong here:
brett@macmint ~/brett-gevent-ctypes/examples $ ./ctypes-helloworld.py
<module 'gevent' from '../gevent/__init__.pyc'>
/home/brett/brett-gevent-ctypes/examples
[[dynamic library loaded: libev]]
C functions loaded: 107
C functions failed: 16
Starting echo server on port 6000
('----------setting callback', <bound method StreamServer._do_read of <StreamServer at 0x7f9c9f2d6710 fileno=5 address=0.0.0.0:6000 handle=echo>>)
________________________________________________________________________________
('set_exc_info', None, None)
('----------setting callback', <built-in method switch of Greenlet object at 0x7f9c9f2c7d10>)
________________________________________________________________________________
('set_exc_info', None, None)
Traceback (most recent call last):
File "./ctypes-helloworld.py", line 45, in <module>
server.serve_forever()
File "../gevent/baseserver.py", line 289, in serve_forever
Greenlet.spawn(self.stop, timeout=stop_timeout).join()
File "../gevent/greenlet.py", line 306, in join
assert result is self, 'Invalid switch into Greenlet.join(): %r' % (result, )
AssertionError: Invalid switch into Greenlet.join(): ()