Message156791
With my patch, Python doesn't check __builtins__ type whereas ceval.c replaces any lookup error by a NameError. Example:
$ ./python
Python 3.3.0a1+ (default:f8d01c8baf6a+, Mar 26 2012, 01:44:48)
>>> code=compile("print('Hello World!')", "", "exec")
>>> exec(code,{'__builtins__': {'print': print}})
Hello World!
>>> exec(code,{'__builtins__': {}})
NameError: name 'print' is not defined
>>> exec(code,{'__builtins__': 1})
NameError: name 'print' is not defined
It should only replace the current exception by NameError if the current exception is a LookupError.
And my patch on LOAD_GLOBAL is not correct, it does still call PyDict_GetItem. I'm waiting until #14383 is done before writing a new patch. |
|
Date |
User |
Action |
Args |
2012-03-25 23:59:41 | vstinner | set | recipients:
+ vstinner |
2012-03-25 23:59:41 | vstinner | set | messageid: <1332719981.64.0.880551106391.issue14385@psf.upfronthosting.co.za> |
2012-03-25 23:59:41 | vstinner | link | issue14385 messages |
2012-03-25 23:59:40 | vstinner | create | |
|