numexpr icon indicating copy to clipboard operation
numexpr copied to clipboard

_context threadlocal incompatible with eventlet green threads

Open FrancescAlted opened this issue 10 years ago • 0 comments

From [email protected] on October 29, 2013 18:45:01

What steps will reproduce the problem? luke@node041 ~ $ python Python 2.7.3 (default, Sep 25 2013, 09:17:55) [GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import eventlet eventlet.monkey_patch() import numexpr What is the expected output? What do you see instead? Expected to import cleanly. Instead, it raises: Traceback (most recent call last): File "", line 1, in File "/opt/zymeworks/devtools/4.3/lib/python2.7/site-packages/numexpr-2.0.1-py2.7-linux-x86_64.egg/numexpr/init.py", line 38, in from numexpr.expressions import E File "/opt/zymeworks/devtools/4.3/lib/python2.7/site-packages/numexpr-2.0.1-py2.7-linux-x86_64.egg/numexpr/expressions.py", line 60, in _context = Context({}) File "/opt/zymeworks/devtools/4.3/lib/python2.7/site-packages/numexpr-2.0.1-py2.7-linux-x86_64.egg/numexpr/expressions.py", line 49, in init raise SystemError('init called too many times') SystemError: init called too many times What version of the product are you using? On what operating system? Python 2.7.3 eventlet==0.13.0 numexpr==2.0.1 Please provide any additional information below. I believe there is a problem with the implementation of numexpr.expressions:Context. It overrides the init method and does not call super(). Since dict is available by default, you can simply remove the init method like so:

46,51d60 < initialized = False < def init(self, dict_): < if self.initialized: < raise SystemError('init called too many times') < self.initialized = True < self.dict.update(dict_) 60c69

< _context = Context({})

_context = Context()

Indeed, that fixes the problem for me, but I'm unsure what other implications it may have.

Original issue: http://code.google.com/p/numexpr/issues/detail?id=118

FrancescAlted avatar Jan 22 '14 10:01 FrancescAlted