summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_grammar.py
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2021-04-30 23:23:14 (GMT)
committerGitHub <noreply@github.com>2021-04-30 23:23:14 (GMT)
commite467ec476f624323b8638cf100d1bfbf1d6a21c6 (patch)
treebb63455acc87b4a628e5a6807972b1f1285fca24 /Lib/test/test_grammar.py
parente726a902b7c73a7056b7421d801e47ffff255873 (diff)
downloadcpython-e467ec476f624323b8638cf100d1bfbf1d6a21c6.zip
cpython-e467ec476f624323b8638cf100d1bfbf1d6a21c6.tar.gz
cpython-e467ec476f624323b8638cf100d1bfbf1d6a21c6.tar.bz2
bpo-43995: Fix reference leak in test_grammar (GH-25764)
Diffstat (limited to 'Lib/test/test_grammar.py')
-rw-r--r--Lib/test/test_grammar.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index 46f70e5..ebc9dde 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -2,6 +2,7 @@
# This just tests whether the parser accepts them all.
from test.support import check_syntax_error
+from test.support import import_helper
from test.support.warnings_helper import check_syntax_warning
import inspect
import unittest
@@ -392,13 +393,13 @@ class GrammarTests(unittest.TestCase):
def test_var_annot_in_module(self):
# check that functions fail the same way when executed
# outside of module where they were defined
- from test.ann_module3 import f_bad_ann, g_bad_ann, D_bad_ann
+ ann_module3 = import_helper.import_fresh_module("test.ann_module3")
with self.assertRaises(NameError):
- f_bad_ann()
+ ann_module3.f_bad_ann()
with self.assertRaises(NameError):
- g_bad_ann()
+ ann_module3.g_bad_ann()
with self.assertRaises(NameError):
- D_bad_ann(5)
+ ann_module3.D_bad_ann(5)
def test_var_annot_simple_exec(self):
gns = {}; lns= {}