mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-132386: Fix a crash when passing a dict subclass to exec
(GH-132412)
* Fix crash when passing a dict subclass to exec * Add news entry
This commit is contained in:
parent
deda47d6e1
commit
e6ef47ac22
3 changed files with 14 additions and 0 deletions
|
@ -1636,6 +1636,16 @@ class TestSpecifics(unittest.TestCase):
|
|||
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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue