@@ -25,7 +25,7 @@ static void* _PyMem_DebugRealloc(void *ctx, void *ptr, size_t size);
25
25
static void _PyMem_DebugFree (void * ctx , void * p );
26
26
27
27
static void _PyObject_DebugDumpAddress (const void * p );
28
- static void _PyMem_DebugCheckAddress (char api_id , const void * p );
28
+ static void _PyMem_DebugCheckAddress (const char * func , char api_id , const void * p );
29
29
30
30
static void _PyMem_SetupDebugHooksDomain (PyMemAllocatorDomain domain );
31
31
@@ -2205,7 +2205,7 @@ _PyMem_DebugRawFree(void *ctx, void *p)
2205
2205
uint8_t * q = (uint8_t * )p - 2 * SST ; /* address returned from malloc */
2206
2206
size_t nbytes ;
2207
2207
2208
- _PyMem_DebugCheckAddress (api -> api_id , p );
2208
+ _PyMem_DebugCheckAddress (__func__ , api -> api_id , p );
2209
2209
nbytes = read_size_t (q );
2210
2210
nbytes += PYMEM_DEBUG_EXTRA_BYTES ;
2211
2211
memset (q , PYMEM_DEADBYTE , nbytes );
@@ -2230,7 +2230,7 @@ _PyMem_DebugRawRealloc(void *ctx, void *p, size_t nbytes)
2230
2230
#define ERASED_SIZE 64
2231
2231
uint8_t save [2 * ERASED_SIZE ]; /* A copy of erased bytes. */
2232
2232
2233
- _PyMem_DebugCheckAddress (api -> api_id , p );
2233
+ _PyMem_DebugCheckAddress (__func__ , api -> api_id , p );
2234
2234
2235
2235
data = (uint8_t * )p ;
2236
2236
head = data - 2 * SST ;
@@ -2314,41 +2314,42 @@ _PyMem_DebugRawRealloc(void *ctx, void *p, size_t nbytes)
2314
2314
}
2315
2315
2316
2316
static inline void
2317
- _PyMem_DebugCheckGIL (void )
2317
+ _PyMem_DebugCheckGIL (const char * func )
2318
2318
{
2319
2319
if (!PyGILState_Check ()) {
2320
- Py_FatalError ("Python memory allocator called "
2321
- "without holding the GIL" );
2320
+ _Py_FatalErrorFunc (func ,
2321
+ "Python memory allocator called "
2322
+ "without holding the GIL" );
2322
2323
}
2323
2324
}
2324
2325
2325
2326
static void *
2326
2327
_PyMem_DebugMalloc (void * ctx , size_t nbytes )
2327
2328
{
2328
- _PyMem_DebugCheckGIL ();
2329
+ _PyMem_DebugCheckGIL (__func__ );
2329
2330
return _PyMem_DebugRawMalloc (ctx , nbytes );
2330
2331
}
2331
2332
2332
2333
static void *
2333
2334
_PyMem_DebugCalloc (void * ctx , size_t nelem , size_t elsize )
2334
2335
{
2335
- _PyMem_DebugCheckGIL ();
2336
+ _PyMem_DebugCheckGIL (__func__ );
2336
2337
return _PyMem_DebugRawCalloc (ctx , nelem , elsize );
2337
2338
}
2338
2339
2339
2340
2340
2341
static void
2341
2342
_PyMem_DebugFree (void * ctx , void * ptr )
2342
2343
{
2343
- _PyMem_DebugCheckGIL ();
2344
+ _PyMem_DebugCheckGIL (__func__ );
2344
2345
_PyMem_DebugRawFree (ctx , ptr );
2345
2346
}
2346
2347
2347
2348
2348
2349
static void *
2349
2350
_PyMem_DebugRealloc (void * ctx , void * ptr , size_t nbytes )
2350
2351
{
2351
- _PyMem_DebugCheckGIL ();
2352
+ _PyMem_DebugCheckGIL (__func__ );
2352
2353
return _PyMem_DebugRawRealloc (ctx , ptr , nbytes );
2353
2354
}
2354
2355
@@ -2358,7 +2359,7 @@ _PyMem_DebugRealloc(void *ctx, void *ptr, size_t nbytes)
2358
2359
* The API id, is also checked.
2359
2360
*/
2360
2361
static void
2361
- _PyMem_DebugCheckAddress (char api , const void * p )
2362
+ _PyMem_DebugCheckAddress (const char * func , char api , const void * p )
2362
2363
{
2363
2364
const uint8_t * q = (const uint8_t * )p ;
2364
2365
char msgbuf [64 ];
@@ -2406,7 +2407,7 @@ _PyMem_DebugCheckAddress(char api, const void *p)
2406
2407
2407
2408
error :
2408
2409
_PyObject_DebugDumpAddress (p );
2409
- Py_FatalError ( msg );
2410
+ _Py_FatalErrorFunc ( func , msg );
2410
2411
}
2411
2412
2412
2413
/* Display info to stderr about the memory block at p. */
0 commit comments