Message157573
| Author |
vstinner |
| Recipients |
vstinner |
| Date |
2012年04月05日.12:09:41 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1333627782.45.0.741262125731.issue14385@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
New version:
- if __build_class__ is missing, raise a NameError instead of surprising ImportError
- add tests
- if PyObject_GetItem on __builtins__ or globals fail, only raise NameError if the exception is a KeyError
Before my patch, a new dict was created for builtins if __builtins__ exists in global but is not a dict. With my patch, the __builtins__ is kept and the type is checked at runtime. If __builtins__ is not a mapping, an exception is raised on lookup in ceval.c.
We may check __builtins__ type in PyFrame_New() using:
PyDict_Check(builtins) || (PyMapping_Check(mapping) && !PyList_Check(mapping) && !PyTuple_Check(mapping))
(PyDict_Check(builtins) is checked first for performance) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年04月05日 12:09:42 | vstinner | set | recipients:
+ vstinner |
| 2012年04月05日 12:09:42 | vstinner | set | messageid: <1333627782.45.0.741262125731.issue14385@psf.upfronthosting.co.za> |
| 2012年04月05日 12:09:41 | vstinner | link | issue14385 messages |
| 2012年04月05日 12:09:41 | vstinner | create |
|