shunwang / numexpr

Automatically exported from code.google.com/p/numexpr
MIT License
0 stars 0 forks source link

python segfault from doubly defined procedure + numexpr #98

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

#This segfaults python. 

def f():
  a = np.arange(10000000)
  string = "(a==3) | (a==1)"
  eval(string)

def f():
  a = np.arange(10000000)
  string = "(a==3) | (a==1)"
  ne.evaluate(string)

print timeit.repeat("f()","from __main__ import f",number=10);

What is the expected output? What do you see instead?

The code should redefine f and run normally, producing e.g. some timing 
information. 
Instead you get a segfault.

Removing the first definition of f() results in this output:
[0.7341048717498779, 0.7121732234954834, 0.6966848373413086]
(which incidentally, is slower than numpy by 5-10%...)

Similarly replacing ne.evaluate with eval in the second definition prevents the 
segfault.
so the segfault is being caused by numexpr and the function redefinition 
somehow.

What version of the product are you using? On what operating system?

python 2.7, macos
numexpr 1.4.2

Please provide any additional information below.

Original issue reported on code.google.com by graeme.b...@gmail.com on 10 Apr 2013 at 10:26

GoogleCodeExporter commented 9 years ago
Hi I cannot reproduce your problem using numexpr 2.1.

I am going to close this, but feel free to reopen it in case you continue 
experiencing the problem with a newer numexpr.

Original comment by fal...@gmail.com on 29 Aug 2013 at 9:01

GoogleCodeExporter commented 9 years ago
OK, will try again if I try out numexpr again in future. Glad to hear it
may be fixed.

Original comment by graeme.b...@gmail.com on 29 Aug 2013 at 9:08