GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

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

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: Py_CLEAR/Py_SETREF() regression on the main branch with C++: SEGV with simple numpy program #157649

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
vstinner added 2 commits October 13, 2026 08:40
@vstinner
pythongh-157649: Check for reference leak in test_cext (python#158227)
f3ef633
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)
@vstinner
pythongh-149044: Build test_cext with -Wall -Wextra (python#158867)
46b99dd
(cherry picked from commit b22a8c9)
@vstinner vstinner added the skip news label Oct 13, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Oct 13, 2026
Py_CLEAR/Py_SETREF() regression on the main branch with C++: SEGV with simple numpy program #157649
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label Oct 13, 2026
@vstinner

vstinner commented Oct 13, 2026

Copy link
Copy Markdown
Member Author

!buildbot s390x Fedora Stable PR

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Oct 13, 2026

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
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
vstinner merged commit 8514386 into python:3.15 Oct 13, 2026
55 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
vstinner deleted the test_cext15 branch October 13, 2026 12:21
@bedevere-app bedevere-app Bot removed the awaiting core review label Oct 13, 2026
@bedevere-app

This comment was marked as outdated.

Sign in to view
@bedevere-app

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.

All reactions

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
@vstinner
[3.14] gh-157649: Check for reference leak in test_cext (#159296) (#1…
dd78c51
…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.
@bedevere-bot

bedevere-bot commented Oct 13, 2026

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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Oct 13, 2026

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
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

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.

2 participants

@vstinner @bedevere-bot
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.