Skip to content

Commit 6fbc924

Browse files
authored
bpo-38187: Fix reference leak in test_tools (GH-16233)
1 parent c275312 commit 6fbc924

File tree

2 files changed

+6
-0
lines changed
  • Lib/test/test_tools/test_c_analyzer/test_c_analyzer_common
  • Tools/c-analyzer/c_parser

2 files changed

+6
-0
lines changed

Lib/test/test_tools/test_c_analyzer/test_c_analyzer_common/test_known.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ class FromFileTests(unittest.TestCase):
1515

1616
_return_read_tsv = ()
1717

18+
def tearDown(self):
19+
Variable._isglobal.instances.clear()
20+
1821
@property
1922
def calls(self):
2023
try:

Tools/c-analyzer/c_parser/info.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class Variable(_NTBase,
2222
__slots__ = ()
2323
_isglobal = util.Slot()
2424

25+
def __del__(self):
26+
del self._isglobal
27+
2528
@classonly
2629
def from_parts(cls, filename, funcname, name, vartype, isglobal=False):
2730
id = info.ID(filename, funcname, name)

0 commit comments

Comments
 (0)