[Numpy-tickets] [NumPy] #378: NumPy or Python crashing with segfault

NumPy numpy-tickets at scipy.net
Wed Nov 15 07:23:40 CST 2006


#378: NumPy or Python crashing with segfault
--------------------------------+-------------------------------------------
 Reporter:  tecki               |        Owner:  somebody
     Type:  defect              |       Status:  reopened
 Priority:  normal              |    Milestone:          
Component:  numpy.core          |      Version:          
 Severity:  normal              |   Resolution:          
 Keywords:  segfault vectorize  |  
--------------------------------+-------------------------------------------
Comment (by tecki):

 I just wrote the mentioned script:

 {{{
 import numpy
 import sys

 a = numpy.arange(100 * 100)
 b = a.reshape(100, 100)
 c = b

 # create enough references to all the values
 # (otherwise script crashes on my system)
 l = [a.tolist() for i in range(30)]

 i = 1

 def p(x, y):
         return 123

 v = numpy.vectorize(p)

 for j in range(15):
         d = v(b, c)
         print sys.getrefcount(i)
 }}}

 With the unpatched version, this gives:

 {{{
 548
 547
 544
 542
 540
 538
 536
 534
 532
 530
 528
 526
 524
 522
 520
 }}}

 so, the refcounter gets decreased by 2 everytime the vectorized function
 is called.
 On the other hand, my patched version gives:

 {{{
 695
 696
 695
 695
 695
 695
 695
 695
 695
 695
 695
 695
 695
 695
 695
 }}}

 So no changes each round. (The different value from the beginning is due
 to the
 fact that the unpatched and the patched python versions are actually
 different
 pythons, for the former 2.4.3, for the latter 2.5)

-- 
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/378#comment:12>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list