Skip to content

Commit e467ec4

Browse files
author
Erlend Egeberg Aasland
authored
bpo-43995: Fix reference leak in test_grammar (GH-25764)
1 parent e726a90 commit e467ec4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Lib/test/test_grammar.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# This just tests whether the parser accepts them all.
33

44
from test.support import check_syntax_error
5+
from test.support import import_helper
56
from test.support.warnings_helper import check_syntax_warning
67
import inspect
78
import unittest
@@ -392,13 +393,13 @@ def test_var_annot_module_semantics(self):
392393
def test_var_annot_in_module(self):
393394
# check that functions fail the same way when executed
394395
# outside of module where they were defined
395-
from test.ann_module3 import f_bad_ann, g_bad_ann, D_bad_ann
396+
ann_module3 = import_helper.import_fresh_module("test.ann_module3")
396397
with self.assertRaises(NameError):
397-
f_bad_ann()
398+
ann_module3.f_bad_ann()
398399
with self.assertRaises(NameError):
399-
g_bad_ann()
400+
ann_module3.g_bad_ann()
400401
with self.assertRaises(NameError):
401-
D_bad_ann(5)
402+
ann_module3.D_bad_ann(5)
402403

403404
def test_var_annot_simple_exec(self):
404405
gns = {}; lns= {}

0 commit comments

Comments
 (0)