We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2073694 commit c7bb3cdCopy full SHA for c7bb3cd
Lib/test/test_frame.py
@@ -187,22 +187,14 @@ def get_frame():
187
188
frame = get_frame()
189
190
- class Fuse:
191
- cleared = False
192
- def __init__(self, s):
193
- self.s = s
194
- def __hash__(self):
195
- return hash(self.s)
196
- def __eq__(self, other):
197
- if not Fuse.cleared and other == "boom":
198
- Fuse.cleared = True
199
- Fuse.frame.clear()
200
- return False
+ class Fuse(dict):
+ def __getitem__(self, key):
+ if key == "boom":
+ frame.clear()
+ raise KeyError(key)
201
202
- Fuse.frame = frame
203
- frame.f_locals[Fuse("boom")] = 0
204
with self.assertRaises(NameError):
205
- exec("boom", {}, frame.f_locals)
+ exec("boom", {}, Fuse())
206
207
208
class FrameAttrsTest(unittest.TestCase):
0 commit comments