Skip to content

[3.14] GH-134774: fix 'Py_DEBUG': macro redefinition warnings for Windows debug builds #134791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2025

Conversation

chris-eibl
Copy link
Member

@chris-eibl chris-eibl commented May 27, 2025

Since PR #134211 / issue #133779 was packported to 3.14, Windows debug builds show more than thousand such warnings:

pyconfig.h(390,16): warning C4005: 'Py_DEBUG': macro redefinition

This stems from

cpython/PC/pyconfig.h

Lines 97 to 100 in b6e624a

/* _DEBUG implies Py_DEBUG */
#ifdef _DEBUG
# define Py_DEBUG 1
#endif

which got added in the above PR, but rather belong to PR #131944 / issue #131942 and should just be deleted.

@chris-eibl
Copy link
Member Author

Sorry for the other PR: I've messed up and immediately closed again.

So sorry for the churn but I never did a PR against something else than main before.

Had to get 3.14 into my fork since when I've created it some time ago I chose the recommended "only main branch" option.

This seems correct now, but cannot do anything more regarding the other PR than immediately closing :(

@serhiy-storchaka serhiy-storchaka requested a review from zooba May 27, 2025 15:54
Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

This code exists in main. Should not we start with main?

@chris-eibl
Copy link
Member Author

The removed lines were just erroneously part of the backport #134211 and belong to a different issue #131942 which is "good" on main. Neither main nor 3.13, etc, are affected. Only 3.14. See also #134774 (comment):

Yeah, probably just a bad backport. Make a PR directly against the 3.14 branch, and include [3.14] at the start of the title to satisfy the backport checker.

Comment on lines -97 to -100
/* _DEBUG implies Py_DEBUG */
#ifdef _DEBUG
# define Py_DEBUG 1
#endif
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this the one we want to keep? The earlier definition is the new one, to fix an issue with .lib selection.

Copy link
Member

Choose a reason for hiding this comment

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

Oh I see, the rest of that change didn't get backported. This is fine

@zooba zooba merged commit 6c74700 into python:3.14 May 27, 2025
44 checks passed
@chris-eibl chris-eibl deleted the fix_Py_DEBUG_warnings_3.14 branch May 28, 2025 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants