Skip to content

Commit 66ea175

Browse files
committed
Remove manual sys.getrefcount check in favor of regrtest --huntrleaks
1 parent fb17c68 commit 66ea175

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

Lib/test/test_ctypes/test_refcounts.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,25 +102,15 @@ def test_callback_py_object_none_return(self):
102102
# bpo-36880: test that returning None from a py_object callback
103103
# does not decrement the refcount of None.
104104

105-
import sys
106-
107105
for FUNCTYPE in (ctypes.CFUNCTYPE, ctypes.PYFUNCTYPE):
108106
with self.subTest(FUNCTYPE=FUNCTYPE):
109107
@FUNCTYPE(ctypes.py_object)
110108
def func():
111109
return None
112110

113111
# Check that calling func does not affect None's refcount.
114-
none_refcount = sys.getrefcount(None)
115-
# Because None's refcount can also change for other reasons,
116-
# we call func in a loop to ensure that any effects on None's
117-
# refcount are clearly visible.
118112
for _ in range(10000):
119113
func()
120-
# Allow for small variations in None's refcount from other
121-
# sources.
122-
self.assertAlmostEqual(
123-
sys.getrefcount(None), none_refcount, delta=50)
124114

125115
if __name__ == '__main__':
126116
unittest.main()

0 commit comments

Comments
 (0)