diff --git a/Include/internal/pycore_dtoa.h b/Include/internal/pycore_dtoa.h index 67189cf0ade665..b93931b020431f 100644 --- a/Include/internal/pycore_dtoa.h +++ b/Include/internal/pycore_dtoa.h @@ -22,15 +22,6 @@ Bigint { ULong x[1]; }; -#ifdef Py_USING_MEMORY_DEBUGGER - -struct _dtoa_runtime_state { - int _not_used; -}; -#define _dtoa_runtime_state_INIT {0} - -#else // !Py_USING_MEMORY_DEBUGGER - /* The size of the Bigint freelist */ #define Bigint_Kmax 7 @@ -53,8 +44,6 @@ struct _dtoa_runtime_state { .preallocated_next = runtime.dtoa.preallocated, \ } -#endif // !Py_USING_MEMORY_DEBUGGER - /* These functions are used by modules compiled as C extension like math: they must be exported. */ diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-02-13-20-47-40.gh-issue-88929.gK8DdS.rst b/Misc/NEWS.d/next/Core and Builtins/2023-02-13-20-47-40.gh-issue-88929.gK8DdS.rst new file mode 100644 index 00000000000000..70d5966d13b4d0 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-02-13-20-47-40.gh-issue-88929.gK8DdS.rst @@ -0,0 +1,2 @@ +Remove the last place where the previously removed macro +``Py_USING_MEMORY_DEBUGGER`` is checked. Patch by Felipe Rodrigues. diff --git a/Misc/valgrind-python.supp b/Misc/valgrind-python.supp index c9c45ba7ed6de4..3a777c660a72cf 100644 --- a/Misc/valgrind-python.supp +++ b/Misc/valgrind-python.supp @@ -7,9 +7,6 @@ # valgrind --tool=memcheck --suppressions=Misc/valgrind-python.supp \ # ./python -E ./Lib/test/regrtest.py -u gui,network # -# You must edit Objects/obmalloc.c and uncomment Py_USING_MEMORY_DEBUGGER -# to use the preferred suppressions with address_in_range. -# # If you do not want to recompile Python, you can uncomment # suppressions for _PyObject_Free and _PyObject_Realloc. # diff --git a/Python/dtoa.c b/Python/dtoa.c index cff5f1b0658eae..ec1f15cae7a3be 100644 --- a/Python/dtoa.c +++ b/Python/dtoa.c @@ -318,7 +318,6 @@ BCinfo { // struct Bigint is defined in pycore_dtoa.h. typedef struct Bigint Bigint; -#ifndef Py_USING_MEMORY_DEBUGGER /* Memory management: memory is allocated from, and returned to, Kmax+1 pools of memory, where pool k (0 <= k <= Kmax) is for Bigints b with b->maxwds == @@ -395,48 +394,6 @@ Bfree(Bigint *v) #undef private_mem #undef freelist -#else - -/* Alternative versions of Balloc and Bfree that use PyMem_Malloc and - PyMem_Free directly in place of the custom memory allocation scheme above. - These are provided for the benefit of memory debugging tools like - Valgrind. */ - -/* Allocate space for a Bigint with up to 1<k = k; - rv->maxwds = x; - rv->sign = rv->wds = 0; - return rv; -} - -/* Free a Bigint allocated with Balloc */ - -static void -Bfree(Bigint *v) -{ - if (v) { - FREE((void*)v); - } -} - -#endif /* Py_USING_MEMORY_DEBUGGER */ - #define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \ y->wds*sizeof(Long) + 2*sizeof(int)) @@ -671,8 +628,6 @@ mult(Bigint *a, Bigint *b) return c; } -#ifndef Py_USING_MEMORY_DEBUGGER - /* multiply the Bigint b by 5**k. Returns a pointer to the result, or NULL on failure; if the returned pointer is distinct from b then the original Bigint b will have been Bfree'd. Ignores the sign of b. */ @@ -728,58 +683,6 @@ pow5mult(Bigint *b, int k) return b; } -#else - -/* Version of pow5mult that doesn't cache powers of 5. Provided for - the benefit of memory debugging tools like Valgrind. */ - -static Bigint * -pow5mult(Bigint *b, int k) -{ - Bigint *b1, *p5, *p51; - int i; - static const int p05[3] = { 5, 25, 125 }; - - if ((i = k & 3)) { - b = multadd(b, p05[i-1], 0); - if (b == NULL) - return NULL; - } - - if (!(k >>= 2)) - return b; - p5 = i2b(625); - if (p5 == NULL) { - Bfree(b); - return NULL; - } - - for(;;) { - if (k & 1) { - b1 = mult(b, p5); - Bfree(b); - b = b1; - if (b == NULL) { - Bfree(p5); - return NULL; - } - } - if (!(k >>= 1)) - break; - p51 = mult(p5, p5); - Bfree(p5); - p5 = p51; - if (p5 == NULL) { - Bfree(b); - return NULL; - } - } - Bfree(p5); - return b; -} - -#endif /* Py_USING_MEMORY_DEBUGGER */ - /* shift a Bigint b left by k bits. Return a pointer to the shifted result, or NULL on failure. If the returned pointer is distinct from b then the original b will have been Bfree'd. Ignores the sign of b. */