Ticket #4244: execfile.diff

File execfile.diff, 1.5 KB (added by loewis, 6 years ago)
  • twisted/python/dist.py

     
    1515from distutils import core
    1616from distutils.core import Extension
    1717
    18 try:
    19     execfile
    20 except NameError:
    21     from twisted.python.compat import execfile
     18from twisted.python.compat import execfile
    2219
    2320
    2421twisted_subprojects = ["conch", "lore", "mail", "names",
  • twisted/python/compat.py

     
    1515import sys, string, socket, struct
    1616
    1717
    18 def execfile(filename, *args):
    19     return exec(compile(open(filename).read(), filename, 'exec'), *args)
     18if sys.version_info >= (3,0):
     19    # 3.x doesn't have execfile anymore, so we define our own
     20    # The code below is syntactically valid 2.x, but 2.x thinks that a tuple
     21    # gets passed to the exec statement.
     22    def execfile(filename, globals=None, locals=None):
     23        exec(compile(open(filename).read(), filename, 'exec'), globals, locals)
     24else:
     25    from __builtin__ import execfile
    2026
    2127
    2228def inet_pton(af, addr):
  • setup.py

     
    1616import sys, os
    1717
    1818
    19 try:
    20     execfile
    21 except NameError:
    22     from twisted.python.compat import execfile
     19from twisted.python.compat import execfile
    2320
    2421
    2522def getExtensions():