[Python-checkins] bpo-38187: Fix reference leak in test_tools (GH-16233)

Pablo Galindo webhook-mailer at python.org
Tue Sep 17 12:05:07 EDT 2019


https://github.com/python/cpython/commit/6fbc924696b4b5097c273c06ca2d82662940e184
commit: 6fbc924696b4b5097c273c06ca2d82662940e184
branch: master
author: Pablo Galindo <Pablogsal at gmail.com>
committer: GitHub <noreply at github.com>
date: 2019年09月17日T17:04:46+01:00
summary:
bpo-38187: Fix reference leak in test_tools (GH-16233)
files:
M Lib/test/test_tools/test_c_analyzer/test_c_analyzer_common/test_known.py
M Tools/c-analyzer/c_parser/info.py
diff --git a/Lib/test/test_tools/test_c_analyzer/test_c_analyzer_common/test_known.py b/Lib/test/test_tools/test_c_analyzer/test_c_analyzer_common/test_known.py
index 215023da577b..93100e0438cd 100644
--- a/Lib/test/test_tools/test_c_analyzer/test_c_analyzer_common/test_known.py
+++ b/Lib/test/test_tools/test_c_analyzer/test_c_analyzer_common/test_known.py
@@ -15,6 +15,9 @@ class FromFileTests(unittest.TestCase):
 
 _return_read_tsv = ()
 
+ def tearDown(self):
+ Variable._isglobal.instances.clear()
+
 @property
 def calls(self):
 try:
diff --git a/Tools/c-analyzer/c_parser/info.py b/Tools/c-analyzer/c_parser/info.py
index 9ab697978638..d7368b48cde3 100644
--- a/Tools/c-analyzer/c_parser/info.py
+++ b/Tools/c-analyzer/c_parser/info.py
@@ -22,6 +22,9 @@ class Variable(_NTBase,
 __slots__ = ()
 _isglobal = util.Slot()
 
+ def __del__(self):
+ del self._isglobal
+
 @classonly
 def from_parts(cls, filename, funcname, name, vartype, isglobal=False):
 id = info.ID(filename, funcname, name)


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /