mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
bpo-32043: New "developer mode": "-X dev" option (#4413)
Add a new "developer mode": new "-X dev" command line option to enable debug checks at runtime. Changes: * Add unit tests for -X dev * test_cmd_line: replace test.support with support. * Fix _PyRuntimeState_Fini(): Use the same memory allocator than _PyRuntimeState_Init(). * Fix _PyMem_GetDefaultRawAllocator()
This commit is contained in:
parent
05cb728d68
commit
ccb0442a33
7 changed files with 110 additions and 25 deletions
|
@ -64,10 +64,18 @@ _PyRuntimeState_Init(_PyRuntimeState *runtime)
|
|||
void
|
||||
_PyRuntimeState_Fini(_PyRuntimeState *runtime)
|
||||
{
|
||||
/* Use the same memory allocator than _PyRuntimeState_Init() */
|
||||
PyMemAllocatorEx old_alloc, raw_alloc;
|
||||
PyMem_GetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
|
||||
_PyMem_GetDefaultRawAllocator(&raw_alloc);
|
||||
PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &raw_alloc);
|
||||
|
||||
if (runtime->interpreters.mutex != NULL) {
|
||||
PyThread_free_lock(runtime->interpreters.mutex);
|
||||
runtime->interpreters.mutex = NULL;
|
||||
}
|
||||
|
||||
PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
|
||||
}
|
||||
|
||||
#define HEAD_LOCK() PyThread_acquire_lock(_PyRuntime.interpreters.mutex, \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue