mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 00:32:55 +00:00
lit: Provide source locations in cfg files with older Python versions
This commit prospectively brings the benefits of r198766 to older supported Python versions (2.5+). Tested with Python 2.6, 2.7, 3.1 and 3.3 (!) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199009 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1a1ec67710
commit
ca179f4de8
@ -75,12 +75,13 @@ class TestingConfig:
|
|||||||
|
|
||||||
# Load the config script data.
|
# Load the config script data.
|
||||||
data = None
|
data = None
|
||||||
f = open(path)
|
if not OldPy:
|
||||||
try:
|
f = open(path)
|
||||||
data = f.read()
|
try:
|
||||||
except:
|
data = f.read()
|
||||||
litConfig.fatal('unable to load config file: %r' % (path,))
|
except:
|
||||||
f.close()
|
litConfig.fatal('unable to load config file: %r' % (path,))
|
||||||
|
f.close()
|
||||||
|
|
||||||
# Execute the config script to initialize the object.
|
# Execute the config script to initialize the object.
|
||||||
cfg_globals = dict(globals())
|
cfg_globals = dict(globals())
|
||||||
@ -89,7 +90,7 @@ class TestingConfig:
|
|||||||
cfg_globals['__file__'] = path
|
cfg_globals['__file__'] = path
|
||||||
try:
|
try:
|
||||||
if OldPy:
|
if OldPy:
|
||||||
exec("exec data in cfg_globals")
|
execfile(path, cfg_globals)
|
||||||
else:
|
else:
|
||||||
exec(compile(data, path, 'exec'), cfg_globals, None)
|
exec(compile(data, path, 'exec'), cfg_globals, None)
|
||||||
if litConfig.debug:
|
if litConfig.debug:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user