* Fix crash when passing a dict subclass to exec
* Add news entry
pass
[[]]
+ def test_globals_dict_subclass(self):
+ # gh-132386
+ class WeirdDict(dict):
+ pass
+
+ ns = {}
+ exec('def foo(): return a', WeirdDict(), ns)
+
+ self.assertRaises(NameError, ns['foo'])
+
class TestBooleanExpression(unittest.TestCase):
class Value:
def __init__(self):
--- /dev/null
+Fix crash when passing a dict subclass as the ``globals`` parameter to
+:func:`exec`.
_PyEval_FormatExcCheckArg(
PyThreadState_GET(), PyExc_NameError,
NAME_ERROR_MSG, name);
+ *writeto = PyStackRef_NULL;
+ return;
}
}
*writeto = PyStackRef_FromPyObjectSteal(res);