[NumPy-Tickets] [NumPy] #2178: regression: closes not-owned handle

NumPy Trac numpy-tickets@scipy....
Mon Jul 2 14:00:48 CDT 2012


#2178: regression: closes not-owned handle
------------------------+---------------------------------------------------
 Reporter:  yarikoptic  |       Owner:  somebody   
     Type:  defect      |      Status:  new        
 Priority:  normal      |   Milestone:  Unscheduled
Component:  Other       |     Version:  1.6.1      
 Keywords:              |  
------------------------+---------------------------------------------------
 While troubleshooting
 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=669466
 which used to build/test just fine I ran to conclusion that it is numpy's
 regression.  Following snippet


 {{{
 #!/usr/bin/python
 import numpy as np
 print "Numpy version ", np.__version__
 from tempfile import mktemp
 outfile_name = mktemp(suffix='.np')
 outfile = open(outfile_name, 'w')
 np.savez(outfile, data='LOVELY LOAD')
 outfile.close()

 print outfile_name
 outfile = open(outfile_name, 'r', 10000)
 outfile.seek(0)
 print "We seek before just fine"
 print np.load(outfile)['data']
 print "Can we seek after?"
 outfile.seek(0) # Only needed here to simulate closing & reopening file
 print "We could seek after as well"
 }}}

 produces on Debian squeeze

 {{{
 $> python /tmp/numpy-closingbug.py
 Numpy version  1.4.1
 /home/yoh/.tmp/tmpQltbIC.np
 We seek before just fine
 LOVELY LOAD
 Can we seek after?
 We could seek after as well
 }}}

 but on Debian sid

 {{{
 $> /tmp/numpy-closingbug.py
 Numpy version  1.6.2
 /home/yoh/.tmp/tmpdbfXKA.np
 We seek before just fine
 LOVELY LOAD
 Can we seek after?
 Traceback (most recent call last):
   File "/tmp/numpy-closingbug.py", line 20, in <module>
     outfile.seek(0) # Only needed here to simulate closing & reopening
 file
 ValueError: I/O operation on closed file
 }}}
 and with current master:
 {{{
 $> PYTHONPATH=$HOME/proj/numpy /tmp/numpy-closingbug.py
 Numpy version  1.8.0.dev-e15d0bd
 /home/yoh/.tmp/tmpg1uQA4.np
 We seek before just fine
 LOVELY LOAD
 Can we seek after?
 Traceback (most recent call last):
   File "/tmp/numpy-closingbug.py", line 20, in <module>
     outfile.seek(0) # Only needed here to simulate closing & reopening
 file
 ValueError: I/O operation on closed file
 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/2178>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list