Skip to content
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

gh-131942: Use the Python-specific Py_DEBUG macro rather than _DEBUG in Windows-related C code #131944

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

XuehaiPan
Copy link
Contributor

@XuehaiPan XuehaiPan commented Mar 31, 2025

Changes:

  1. Move the definition of Py_DEBUG in PC/pyconfig.h.in to the top of the file.
/* _DEBUG implies Py_DEBUG */
#ifdef _DEBUG
#define Py_DEBUG
#endif
  1. Change usage of _DEBUG to Py_DEBUG by using the regex /\b_DEBUG\b/.
  2. Update the generated files via make regen-all.

Since the sysconfig.h is included in all C headers with top precedence. This PR does not have any user-side visible changes.

#ifndef Py_PYTHON_H
#define Py_PYTHON_H
// Since this is a "meta-include" file, "#ifdef __cplusplus / extern "C" {"
// is not needed.
// Include Python header files
#include "patchlevel.h"
#include "pyconfig.h"
#include "pymacconfig.h"

Resolves #131942

@XuehaiPan XuehaiPan changed the title Use the Python-specific Py_DEBUG macro rather than _DEBUG in Windows-related C code gh-131942: Use the Python-specific Py_DEBUG macro rather than _DEBUG in Windows-related C code Mar 31, 2025
@XuehaiPan XuehaiPan marked this pull request as ready for review March 31, 2025 16:40
@brettcannon brettcannon removed their request for review March 31, 2025 19:53
@vstinner
Copy link
Member

vstinner commented Apr 2, 2025

cc @zooba @zware

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.

Use the Python-specific Py_DEBUG macro rather than _DEBUG in Windows-related C code
3 participants