Skip to content

Commit 8825790

Browse files
committed
Register the namespace cleanup right after creating it
1 parent 76b4d22 commit 8825790

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎Lib/test/test_lazy_import/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,10 @@ def test_deeply_dotted_name(self):
317317
m.m = m
318318
ns = {"__builtins__": {"__lazy_import__": __lazy_import__,
319319
"__import__": lambda *args: m}}
320-
exec("lazy import " + ".".join(["m"] * 10_000) + " as x", ns)
321320
# Free the chain in the main thread: in a thread with a small C stack,
322321
# deallocations deferred by the trashcan are never run.
323322
self.addCleanup(ns.clear)
323+
exec("lazy import " + ".".join(["m"] * 10_000) + " as x", ns)
324324
with contextlib.suppress(RecursionError):
325325
ns["x"].resolve()
326326

0 commit comments

Comments
 (0)