gh-142038: Expand guard for types_world_is_stopped to fix debug builds without assertions by xhochy · Pull Request #142039 · python/cpython · GitHub
Skip to content

gh-142038: Expand guard for types_world_is_stopped to fix debug builds without assertions - #142039

Merged
vstinner merged 2 commits into
python:mainfrom
xhochy:gh-142038
Dec 3, 2025
Merged

gh-142038: Expand guard for types_world_is_stopped to fix debug builds without assertions#142039
vstinner merged 2 commits into
python:mainfrom
xhochy:gh-142038

Conversation

@xhochy

@xhochy xhochy commented Nov 28, 2025

Copy link
Copy Markdown
Contributor

The types_world_is_stopped() function needs to be defined if NDEBUG or when we're in a debug build is not defined.

Issue:

@bedevere-app

bedevere-app Bot commented Nov 28, 2025

Copy link
Copy Markdown

Comment thread Objects/typeobject.c Outdated
#define END_TYPE_DICT_LOCK() Py_END_CRITICAL_SECTION2()

#ifndef NDEBUG
#if !defined(NDEBUG) || defined(Py_Debug)

@picnixz picnixz Nov 28, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of the macro is not Py_Debug but Py_DEBUG And ideally, I think we should instead use Py_DEBUG rather than NDEBUG.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, this should be just Py_DEBUG.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had that before, and that caused problems for non-debug builds with --with-assertions. This issue was then addressed by #140133, which, however, introduced a new problem with debug-without-assertions builds.

@bedevere-app

bedevere-app Bot commented Nov 28, 2025

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@vstinner

vstinner commented Dec 2, 2025

Copy link
Copy Markdown
Member

Can someone else reproduce #142038 issue?

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vstinner
vstinner merged commit f6f456f into python:main Dec 3, 2025
50 checks passed
@bedevere-bot

Copy link
Copy Markdown

@xhochy
xhochy deleted the gh-142038 branch December 4, 2025 09:45
StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
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.

6 participants