Message1575
Logged In: YES
user_id=4771
Patch reviewed:
As eval(expr, mapping) is not accepted but eval(expr, {},
mapping) is, we could have a helpful error message along the
line of
if (!PyDict_Check(globals)) {
PyErr_SetString(PyExc_TypeError,
PyMapping_Check(globals) ?
"globals must be a real dict; try eval(expr,
{}, mapping)"
: "globals must be a dict");
}
LOAD_NAME: you are doing a speed hack here we will bypass a
user-defined __getitem__ on a subclass of dict if the key
actually exists in the dictionary. In other words your test
with the subclass of dict would fail if the dict aditionally
had another real value for the key 'a'. Better use
PyDict_CheckExact() in all cases and only call
PyDict_GetItem() if it is true, as this is really cheap.
Also, no PyErr_Clear() masking arbitrary exceptions please!
|
|
Date |
User |
Action |
Args |
2007-08-23 13:50:45 | admin | link | issue215126 messages |
2007-08-23 13:50:45 | admin | create | |
|