Changeset 20913


Ignore:
Timestamp:
07/14/16 10:40:57 (9 years ago)
Author:
Mathieu Morlighem
Message:

CHG: safer version of exec in python

Location:
issm/trunk-jpl/src/m
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/toolkits.py

    r20910 r20913  
    5252                #Create dynamic property if property does not exist yet
    5353                if not hasattr(self,analysis):
    54 #                       exec("self.%s = None" % analysis)
    5554                        setattr(self,analysis,None)
    5655
  • issm/trunk-jpl/src/m/consistency/checkfield.py

    r19900 r20913  
    4141        else:
    4242                fieldname=options.getfieldvalue('fieldname')
    43                 exec("field=md.%s" % fieldname)
     43                exec("field=md.{}".format(fieldname))
    4444
    4545        if isinstance(field,(bool,int,long,float)):
  • issm/trunk-jpl/src/m/consistency/ismodelselfconsistent.py

    r20380 r20913  
    8484
    8585                #Check consistency of the object
    86                 exec("md.%s.checkconsistency(md,solution,analyses)" % field)
     86                exec("md.{}.checkconsistency(md,solution,analyses)".format(field))
    8787
    8888        #error message if mode is not consistent
Note: See TracChangeset for help on using the changeset viewer.