GeezerVison is showing github.com — [3.15] gh-157649: Check for reference leak in test_cext by vstinner · Pull Request #159296 · python/cpython
Conversation
vstinner
commented
Oct 13, 2026
•
edited by bedevere-app
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
test_cext now discovers and calls all "test" functions. On a debug
build, it also checks for reference leaks.
Fix a reference leak in test_virtual_object(): use a dealloc function
which calls Py_DECREF() on the type, and trigger an explicit garbage
collection.
(cherry picked from commit 7952713)
(cherry picked from commit b22a8c9)
|
!buildbot s390x Fedora Stable PR
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
vstinner
added a commit
that referenced
this pull request
Oct 13, 2026
…59314)
* [3.15] gh-157649: Check for reference leak in test_cext (#159296)
* gh-157649: Check for reference leak in test_cext (#158227)
test_cext now discovers and calls all "test" functions. On a debug
build, it also checks for reference leaks.
Fix a reference leak in test_virtual_object(): use a dealloc function
which calls Py_DECREF() on the type, and trigger an explicit garbage
collection.
(cherry picked from commit 7952713)
* gh-149044: Build test_cext with -Wall -Wextra (#158867)
(cherry picked from commit b22a8c9)
(cherry picked from commit 8514386)
* Fix refleak in test_datetime()
Only call PyDateTime_IMPORT once to initialize PyDateTimeAPI.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️
Hi! The buildbot s390x RHEL9 3.14 (tier-3) has failed when building commit dd78c51.
What do you need to do:
- Don't panic.
- Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
- Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1696/builds/1588) and take a look at the build logs.
- Check if the failure is related to this commit (dd78c51) or if it is a false positive.
- If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.
You can take a look at the buildbot page here:
https://buildbot.python.org/#/builders/1696/builds/1588
Failed tests:
Failed subtests:
- test_build - test.test_cext.TestInteralCpp.test_build
- test_build - test.test_cext.TestPublicCpp.test_build
Summary of the results of the build (if available):
==
Click to see traceback logs
Traceback (most recent call last):
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/__init__.py", line 135, in test_build
self.check_build('_test_cppext')
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/__init__.py", line 104, in check_build
run_cmd('Tests', cmd)
~~~~~~~^^^^^^^^^^^^^^
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/__init__.py", line 79, in run_cmd
subprocess.run(cmd, check=True, env=env)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/subprocess.py", line 578, in run
raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/build/test_python_147966æ/tempcwd/env/bin/python', '-X', 'dev', '/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/runtests.py', '_test_cppext']' returned non-zero exit status 1.
Traceback (most recent call last):
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/runtests.py", line 68, in <module>
main()
~~~~^^
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/runtests.py", line 62, in main
raise AssertionError(f'Tests leaked {diff} references')
AssertionError: Tests leaked 1 references
ERROR
Traceback (most recent call last):
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/__init__.py", line 135, in test_build
self.check_build('_test_cppext')
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/__init__.py", line 104, in check_build
run_cmd('Tests', cmd)
~~~~~~~^^^^^^^^^^^^^^
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/__init__.py", line 79, in run_cmd
subprocess.run(cmd, check=True, env=env)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/subprocess.py", line 578, in run
raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/build/test_python_153655æ/tempcwd/env/bin/python', '-X', 'dev', '/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/runtests.py', '_test_cppext']' returned non-zero exit status 1.
Traceback (most recent call last):
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/__init__.py", line 182, in test_build
self.check_build('_test_cppext_internal')
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/__init__.py", line 104, in check_build
run_cmd('Tests', cmd)
~~~~~~~^^^^^^^^^^^^^^
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/__init__.py", line 79, in run_cmd
subprocess.run(cmd, check=True, env=env)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/subprocess.py", line 578, in run
raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/build/test_python_147966æ/tempcwd/env/bin/python', '-X', 'dev', '/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/runtests.py', '_test_cppext_internal']' returned non-zero exit status 1.
Traceback (most recent call last):
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/__init__.py", line 182, in test_build
self.check_build('_test_cppext_internal')
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/__init__.py", line 104, in check_build
run_cmd('Tests', cmd)
~~~~~~~^^^^^^^^^^^^^^
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/__init__.py", line 79, in run_cmd
subprocess.run(cmd, check=True, env=env)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/subprocess.py", line 578, in run
raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/build/test_python_153655æ/tempcwd/env/bin/python', '-X', 'dev', '/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.14.cstratak-rhel9-s390x/build/Lib/test/test_cext/runtests.py', '_test_cppext_internal']' returned non-zero exit status 1.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️
Hi! The buildbot AMD64 Debian root 3.14 (tier-1) has failed when building commit dd78c51.
What do you need to do:
- Don't panic.
- Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
- Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1742/builds/1841) and take a look at the build logs.
- Check if the failure is related to this commit (dd78c51) or if it is a false positive.
- If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.
You can take a look at the buildbot page here:
https://buildbot.python.org/#/builders/1742/builds/1841
Failed tests:
- test_tokenize
- test_ntpath
- test_decimal
- test_datetime
- test_math
- test_weakref
- test_unicodedata
- test_email
Failed subtests:
- test_no_names_in_pua - test.test_unicodedata.UnicodeFunctionsTest.test_no_names_in_pua
- test_squareroot - test.test_decimal.CIBMTestCases.test_squareroot
- test_threaded_weak_value_dict_deepcopy - test.test_weakref.MappingTestCase.test_threaded_weak_value_dict_deepcopy
- test_random_files - test.test_tokenize.TestRoundtrip.test_random_files
- test_get_param_linear_complexity - test.test_email.test_email.TestMessageAPI.test_get_param_linear_complexity
Summary of the results of the build (if available):
==
Click to see traceback logs
Traceback (most recent call last):
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/test/test_unicodedata.py", line 181, in test_no_names_in_pua
self.assertRaises(ValueError, self.db.name, char)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/unittest/case.py", line 813, in assertRaises
return context.handle('assertRaises', args, kwargs)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/unittest/case.py", line 247, in handle
callable_obj(*args, **kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
TypeError: unicodedata.name() argument after ** must be a mapping, not _AssertRaisesContext
Traceback (most recent call last):
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/test/test_decimal.py", line 5955, in <lambda>
tester = lambda self, f=filename: self.eval_file(directory + f)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/test/test_decimal.py", line 306, in eval_file
t = self.eval_line(line)
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/test/test_decimal.py", line 328, in eval_line
return self.eval_equation(s)
~~~~~~~~~~~~~~~~~~^^^
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/test/test_decimal.py", line 381, in eval_equation
for exception in Signals[self.decimal]:
^^^^^^^^^^^^
AttributeError: 'CIBMTestCases' object has no attribute 'TEST_ALL'
Traceback (most recent call last):
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/test/test_weakref.py", line 2057, in test_threaded_weak_value_dict_deepcopy
self.check_threaded_weak_dict_copy(weakref.WeakValueDictionary, True)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/test/test_weakref.py", line 2029, in check_threaded_weak_dict_copy
raise exc[0]
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/test/test_weakref.py", line 1986, in dict_copy
_ = copy.deepcopy(d)
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/copy.py", line 138, in deepcopy
y = copier(memo)
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/weakref.py", line 157, in __deepcopy__
new[deepcopy(key, memo)] = o
~~~~~~~~^^^^^^^^^^^
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/copy.py", line 157, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/copy.py", line 240, in _reconstruct
state = deepcopy(state, memo)
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/copy.py", line 131, in deepcopy
y = copier(x, memo)
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/copy.py", line 202, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
~~~~~~~~^^^^^^^^^^^^^
TypeError: 'int' object is not callable
Traceback (most recent call last):
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/test/test_tokenize.py", line 2204, in test_random_files
self.check_roundtrip(f)
~~~~~~~~~~~~~~~~~~~~^^^
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/test/test_tokenize.py", line 2039, in check_roundtrip
bytes_from5 = tokenize.untokenize(tokens5)
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/tokenize.py", line 341, in untokenize
out = ut.untokenize(iterable)
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/tokenize.py", line 262, in untokenize
self.add_whitespace(start)
~~~~~~~~~~~~~~~~~~~^^^^^^^
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/tokenize.py", line 178, in add_whitespace
raise ValueError("start ({},{}) precedes previous end ({},{})"
.format(row, col, self.prev_row, self.prev_col))
ValueError: start (291,33) precedes previous end (292,0)
Traceback (most recent call last):
File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/test/test_email/test_email.py", line 497, in test_get_param_linear_complexity
self.assertEqual(len(set(res)), 1)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
AssertionError: 2 != 1
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|