Reputation: 815
As part of a project that started recently, the following is the configuration of the virtual environment we are using:
PyPy 2.2.1
Mysql-python 1.2.5
Storm orm 0.20
PyPy and Storm are basically some of the requirements we were told not to change. But, in a very small test, we are having issues with the Storm ORM. So, trying something very simple like this in our code:
...
users = store.find(User)
for u in users:
print u.fullname
...
produces the following error in the console:
...
Fatal error in cpyext, CPython compatibility layer, calling PyTuple_New
Either report a bug or consider not using this particular extension
<StackOverflow object at 0x1c7c1a8>
RPython traceback:
File "pypy_module_cpyext_api.c", line 35143, in PyTuple_New
File "pypy_module_cpyext_pyobject.c", line 547, in make_ref
File "pypy_module_cpyext_pyobject.c", line 1387, in create_ref
File "rpython_rlib_rstack.c", line 65, in stack_check_slowpath
Thinking that the connector was the problem, we tried using PyMySQL (which is a drop-in replacement for MySQLdb) and we had the same issue. Then, we installed SQLAlchemy and it worked flawlessly, so it seems like the problem is with Storm.
So, anyone knows how to do to make Storm ORM work in a PyPy environment?
Upvotes: 1
Views: 140
Reputation: 815
Ok, after more investigation, it seems like there is a way to use Storm on PyPy. Taken from https://github.com/DamnWidget/mamba/blob/master/mamba/init.py, basically, adding this to my code did the trick:
import sys
if '__pypy__' in sys.modules:
# we are running on PyPy interpreter make sure we don't use the
# Storm C extensions that make PyPy cpyext crash
import os
os.environ.update({'STORM_CEXTENSIONS': '0'})
this way, I haven't experienced any more issues on the other tests I did.
Hope this helps anyone with the same situation.
Upvotes: 2