diff --git a/mypy/test/teststubgen.py b/mypy/test/teststubgen.py index 086ac84fc558..09e821fadb18 100644 --- a/mypy/test/teststubgen.py +++ b/mypy/test/teststubgen.py @@ -948,7 +948,7 @@ class TestClass: def test_generic_class(self) -> None: # This class declaration lives in exec to avoid syntax version on python versions < 3.12 local: dict[str, Any] = {} - exec("class Test[A]: ...", globals(), local) + exec("class Test[A]: ...", None, local) output: list[str] = [] mod = ModuleType("module", "")