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

This commit is contained in:
Xuehai Pan 2025-05-08 23:01:25 +08:00 committed by GitHub
parent e15bbfafbc
commit f0f93ba5fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 32 additions and 28 deletions

View file

@ -108,7 +108,7 @@ static char *GetPythonImport (HINSTANCE hModule)
char *pch;
/* Don't claim that python3.dll is a Python DLL. */
#ifdef _DEBUG
#ifdef Py_DEBUG
if (strcmp(import_name, "python3_d.dll") == 0) {
#else
if (strcmp(import_name, "python3.dll") == 0) {
@ -120,7 +120,7 @@ static char *GetPythonImport (HINSTANCE hModule)
/* Ensure python prefix is followed only
by numbers to the end of the basename */
pch = import_name + 6;
#ifdef _DEBUG
#ifdef Py_DEBUG
while (*pch && pch[0] != '_' && pch[1] != 'd' && pch[2] != '.') {
#else
while (*pch && *pch != '.') {
@ -300,7 +300,7 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
char buffer[256];
PyOS_snprintf(buffer, sizeof(buffer),
#ifdef _DEBUG
#ifdef Py_DEBUG
"python%d%d_d.dll",
#else
"python%d%d.dll",

View file

@ -38,7 +38,7 @@ module marshal
* On Windows PGO builds, the r_object function overallocates its stack and
* can cause a stack overflow. We reduce the maximum depth for all Windows
* releases to protect against this.
* #if defined(MS_WINDOWS) && defined(_DEBUG)
* #if defined(MS_WINDOWS) && defined(Py_DEBUG)
*/
#if defined(MS_WINDOWS)
# define MAX_MARSHAL_STACK_DEPTH 1000

View file

@ -3144,7 +3144,7 @@ static inline void _Py_NO_RETURN
fatal_error_exit(int status)
{
if (status < 0) {
#if defined(MS_WINDOWS) && defined(_DEBUG)
#if defined(MS_WINDOWS) && defined(Py_DEBUG)
DebugBreak();
#endif
abort();