[llvm] r198766 - lit: Provide file location in cfg error messages
Alp Toker
alp at nuanti.com
Sat Jan 11 05:39:13 PST 2014
Python > 3.2 fixed in r199006.
Thanks for reporting.
Alp.
On 11/01/2014 09:35, Alp Toker wrote:
>
> On 11/01/2014 09:10, NAKAMURA Takumi wrote:
>> I wonder execfile() would be py3-incompatible...??
>
> Indeed it seems to have been removed in Python 3.3. The new syntax for
> providing source locations is apparently:
>
> |exec(compile(open(filename, "rb").read(), filename, 'exec'), globals, locals)|
>
> Do you have 3.3+ around to try this? If not I'll take a look in a
> couple of hours.
>
> (It's unfortunate we have to keep chasing different versions of Python.)
>
> Alp.
>
>> 2014/1/8 Alp Toker<alp at nuanti.com>:
>>> Author: alp
>>> Date: Wed Jan 8 08:20:59 2014
>>> New Revision: 198766
>>>
>>> URL:http://llvm.org/viewvc/llvm-project?rev=198766&view=rev
>>> Log:
>>> lit: Provide file location in cfg error messages
>>>
>>> Python doesn't do a good job at diagnosing string exec() so use execfile()
>>> where available.
>>>
>>> This should be a timesaver when trying to get to the bottom of build bot
>>> failures.
>>>
>>> Before:
>>>
>>> File "llvm/utils/lit/lit/TestingConfig.py", line 93, in load_from_path
>>> exec("exec data in cfg_globals")
>>> File "<string>", line 1, in <module>
>>> File "<string>", line 194, in <module>
>>> NameError: name 'typo' is not defined
>>>
>>> After:
>>>
>>> File "llvm/utils/lit/lit/TestingConfig.py", line 95, in load_from_path
>>> execfile(path, cfg_globals)
>>> File "clang/test/lit.cfg", line 194, in <module>
>>> typo
>>> ^~~~
>>> NameError: name 'typo' is not defined
>>>
>>> Modified:
>>> llvm/trunk/utils/lit/lit/TestingConfig.py
>>>
>>> Modified: llvm/trunk/utils/lit/lit/TestingConfig.py
>>> URL:http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestingConfig.py?rev=198766&r1=198765&r2=198766&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/utils/lit/lit/TestingConfig.py (original)
>>> +++ llvm/trunk/utils/lit/lit/TestingConfig.py Wed Jan 8 08:20:59 2014
>>> @@ -1,7 +1,7 @@
>>> import os
>>> import sys
>>>
>>> -PY2 = sys.version_info[0] < 3
>>> +OldPy = sys.version_info[0] == 2 and sys.version_info[1] < 6
>>>
>>> class TestingConfig:
>>> """"
>>> @@ -74,12 +74,14 @@ class TestingConfig:
>>> """
>>>
>>> # Load the config script data.
>>> - f = open(path)
>>> - try:
>>> - data = f.read()
>>> - except:
>>> - litConfig.fatal('unable to load config file: %r' % (path,))
>>> - f.close()
>>> + data = None
>>> + if OldPy:
>>> + f = open(path)
>>> + try:
>>> + data = f.read()
>>> + except:
>>> + litConfig.fatal('unable to load config file: %r' % (path,))
>>> + f.close()
>>>
>>> # Execute the config script to initialize the object.
>>> cfg_globals = dict(globals())
>>> @@ -87,10 +89,10 @@ class TestingConfig:
>>> cfg_globals['lit_config'] = litConfig
>>> cfg_globals['__file__'] = path
>>> try:
>>> - if PY2:
>>> + if OldPy:
>>> exec("exec data in cfg_globals")
>>> else:
>>> - exec(data, cfg_globals)
>>> + execfile(path, cfg_globals)
>>> if litConfig.debug:
>>> litConfig.note('... loaded config %r' % path)
>>> except SystemExit:
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> --
> http://www.nuanti.com
> the browser experts
--
http://www.nuanti.com
the browser experts
More information about the llvm-commits
mailing list