FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.15] gh-157649: Check for reference leak in test_cext by vstinner · Pull Request #159296 · python/cpython · GitHub

Repository navigation

[3.15] gh-157649: Check for reference leak in test_cext - #159296

Merged
vstinner merged 2 commits into
python:3.15from
vstinner:test_cext15
Oct 13, 2026
Merged

vstinner merged 2 commits into
python:3.15from
vstinner:test_cext15

Conversation

vstinner commented Oct 13, 2026 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

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)

Copy link
Copy Markdown
Member Author

!buildbot s390x Fedora Stable PR

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @vstinner for commit 46b99dd 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F159296%2Fmerge

The command will test the builders whose names match following regular expression: s390x Fedora Stable PR

The builders matched are:

  • s390x Fedora Stable PR

vstinner merged commit 8514386 into python:3.15 Oct 13, 2026
55 checks passed
vstinner deleted the test_cext15 branch October 13, 2026 12:21

This comment was marked as outdated.

bedevere-app Bot commented Oct 13, 2026

Copy link
Copy Markdown

GH-159314 is a backport of this pull request to the 3.14 branch.

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.

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot s390x RHEL9 3.14 (tier-3) has failed when building commit dd78c51.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. 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.
  4. Check if the failure is related to this commit (dd78c51) or if it is a false positive.
  5. 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:

  • test_cext

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.

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Debian root 3.14 (tier-1) has failed when building commit dd78c51.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. 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.
  4. Check if the failure is related to this commit (dd78c51) or if it is a false positive.
  5. 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

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL