[NumPy-Tickets] [NumPy] #1932: f2py crashes with UnboundLocalError exception

NumPy Trac numpy-tickets@scipy....
Wed Aug 29 08:50:22 CDT 2012

#1932: f2py crashes with UnboundLocalError exception
 Reporter:  josdekloe   |       Owner:  pearu      
     Type:  defect      |      Status:  new        
 Priority:  normal      |   Milestone:  Unscheduled
Component:  numpy.f2py  |     Version:  1.6.2      
 Keywords:              |  
Changes (by josdekloe):

 * cc: kloe0040@… (added)
  * version:  1.5.1 => 1.6.2


 The same problem still is present in f2py version 1.6.2 as currently
 shipped by Fedora17.
 After some debugging I found that the code
     exec('c = isintent_%s(var)' % intent)
 in file:
 does not work as intended on my python3 version (version  3.2.3).

 In function true_intent_list this code:

             exec('c = isintent_%s(var)' % intent)
         except NameError:
             c = 0

 does not always work as intended, and on my system it does not define a
 variable 'c' in the local scope of this function.
 In stead the correct code should be:

             ldict = locals()
             exec('c = isintent_%s(var)' % intent,globals(),ldict)
             c = ldict['c']
         except NameError:
             c = 0

 This type of problem has been reported and discussed before, for example
 and here:

Ticket URL: <http://projects.scipy.org/numpy/ticket/1932#comment:1>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list