From bd92307d34f6e1f9c70025b3b4934d4b95c2f091 Mon Sep 17 00:00:00 2001 From: ahgamut <41098605+ahgamut@users.noreply.github.com> Date: Sat, 2 Oct 2021 02:10:29 +0530 Subject: [PATCH] use IsModeDbg everywhere --- third_party/python/Include/abstract.h | 2 +- third_party/python/Include/ceval.h | 2 +- third_party/python/Include/pyerrors.h | 2 +- third_party/python/Include/pymem.h | 2 +- third_party/python/Modules/_tracemalloc.c | 2 +- third_party/python/Objects/obmalloc.c | 2 +- third_party/python/Python/pylifecycle.c | 2 +- third_party/python/pyconfig.h | 4 ---- 8 files changed, 7 insertions(+), 11 deletions(-) diff --git a/third_party/python/Include/abstract.h b/third_party/python/Include/abstract.h index 63370f91c..bdca099b3 100644 --- a/third_party/python/Include/abstract.h +++ b/third_party/python/Include/abstract.h @@ -35,7 +35,7 @@ PyObject *_PyObject_FastCallKeywords(PyObject *func, PyObject **args, PyObject *_PyObject_Call_Prepend(PyObject *func, PyObject *obj, PyObject *args, PyObject *kwargs); -#ifdef USE_CHECKFUNCRESULT +#if IsModeDbg() PyObject *_Py_CheckFunctionResult(PyObject *func, PyObject *result, const char *where); #else diff --git a/third_party/python/Include/ceval.h b/third_party/python/Include/ceval.h index bfdfc1f34..34864036a 100644 --- a/third_party/python/Include/ceval.h +++ b/third_party/python/Include/ceval.h @@ -77,7 +77,7 @@ int Py_MakePendingCalls(void); void Py_SetRecursionLimit(int); int Py_GetRecursionLimit(void); -#ifdef USE_RECURSIVECHECK +#if IsModeDbg() #define Py_EnterRecursiveCall(where) \ (_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \ _Py_CheckRecursiveCall(where)) diff --git a/third_party/python/Include/pyerrors.h b/third_party/python/Include/pyerrors.h index b153ebd95..fff039e3b 100644 --- a/third_party/python/Include/pyerrors.h +++ b/third_party/python/Include/pyerrors.h @@ -316,7 +316,7 @@ void PyErr_BadInternalCall(void); void _PyErr_BadInternalCall(const char *filename, int lineno); /* Mask the old API with a call to the new API for code compiled under Python 2.0: */ -#ifdef USE_BADINTERNALCALL +#if IsModeDbg() #define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__) #else #define PyErr_BadInternalCall() diff --git a/third_party/python/Include/pymem.h b/third_party/python/Include/pymem.h index e77e796c1..4bd581657 100644 --- a/third_party/python/Include/pymem.h +++ b/third_party/python/Include/pymem.h @@ -66,7 +66,7 @@ PyObject* _PyTraceMalloc_GetTraceback( int _PyMem_IsFreed(void *ptr, size_t size); -#ifndef USE_TRACEMALLOC +#if !IsModeDbg() #define _PyTraceMalloc_Track(domain, ptr, size) (-2) #define _PyTraceMalloc_Untrack(domain, ptr) (-2) #define _PyTraceMalloc_GetTraceback(domain, ptr) (&_Py_NoneStruct) diff --git a/third_party/python/Modules/_tracemalloc.c b/third_party/python/Modules/_tracemalloc.c index fb7a9a8f4..0c0f04a92 100644 --- a/third_party/python/Modules/_tracemalloc.c +++ b/third_party/python/Modules/_tracemalloc.c @@ -41,7 +41,7 @@ PYTHON_PROVIDE("_tracemalloc.is_tracing"); PYTHON_PROVIDE("_tracemalloc.start"); PYTHON_PROVIDE("_tracemalloc.stop"); -#ifdef USETRACEMALLOC +#if IsModeDbg() /* Trace memory blocks allocated by PyMem_RawMalloc() */ #define TRACE_RAW_MALLOC diff --git a/third_party/python/Objects/obmalloc.c b/third_party/python/Objects/obmalloc.c index 66c1796c2..e1b0051a0 100644 --- a/third_party/python/Objects/obmalloc.c +++ b/third_party/python/Objects/obmalloc.c @@ -2291,7 +2291,7 @@ _PyObject_DebugDumpAddress(const void *p) fputc('\n', stderr); fflush(stderr); -#ifdef USE_TRACEMALLOC +#if IsModeDbg() PYTHON_YOINK("_tracemalloc"); _PyMem_DumpTraceback(fileno(stderr), p); #endif diff --git a/third_party/python/Python/pylifecycle.c b/third_party/python/Python/pylifecycle.c index 6ddc484dd..cdc0abdfa 100644 --- a/third_party/python/Python/pylifecycle.c +++ b/third_party/python/Python/pylifecycle.c @@ -274,7 +274,7 @@ _Py_InitializeEx_Private(int install_sigs, int install_importlib) if (install_sigs) _Py_InitSigs(); /* Signal handling stuff, including initintr() */ -#ifdef USE_TRACEMALLOC +#if IsModeDbg() if (_PyTraceMalloc_Init() < 0) Py_FatalError("Py_Initialize: can't initialize tracemalloc"); #endif diff --git a/third_party/python/pyconfig.h b/third_party/python/pyconfig.h index 8d854d2b9..5bea67ecf 100644 --- a/third_party/python/pyconfig.h +++ b/third_party/python/pyconfig.h @@ -574,11 +574,7 @@ #define HAVE_LANGINFO_H 1 #if IsModeDbg() -#define USE_RECURSIVECHECK 1 -#define USE_CHECKFUNCRESULT 1 -#define USE_BADINTERNALCALL 1 #define Py_DEBUG 1 -#define USE_TRACEMALLOC 1 #endif /* #define FAST_LOOPS 1 /\* froot loops *\/ */