mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +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
|
|
@ -190,8 +190,14 @@ static struct {
|
|||
void
|
||||
_PyMem_GetDefaultRawAllocator(PyMemAllocatorEx *alloc_p)
|
||||
{
|
||||
PyMemAllocatorEx alloc = {NULL, PYRAW_FUNCS};
|
||||
*alloc_p = alloc;
|
||||
PyMemAllocatorEx pymem_raw = {
|
||||
#ifdef Py_DEBUG
|
||||
&_PyMem_Debug.raw, PYRAWDBG_FUNCS
|
||||
#else
|
||||
NULL, PYRAW_FUNCS
|
||||
#endif
|
||||
};
|
||||
*alloc_p = pymem_raw;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -274,13 +280,6 @@ _PyObject_Initialize(struct _pyobj_runtime_state *state)
|
|||
void
|
||||
_PyMem_Initialize(struct _pymem_runtime_state *state)
|
||||
{
|
||||
PyMemAllocatorEx pymem_raw = {
|
||||
#ifdef Py_DEBUG
|
||||
&_PyMem_Debug.raw, PYRAWDBG_FUNCS
|
||||
#else
|
||||
NULL, PYRAW_FUNCS
|
||||
#endif
|
||||
};
|
||||
PyMemAllocatorEx pymem = {
|
||||
#ifdef Py_DEBUG
|
||||
&_PyMem_Debug.mem, PYDBG_FUNCS
|
||||
|
|
@ -296,7 +295,7 @@ _PyMem_Initialize(struct _pymem_runtime_state *state)
|
|||
#endif
|
||||
};
|
||||
|
||||
state->allocators.raw = pymem_raw;
|
||||
_PyMem_GetDefaultRawAllocator(&state->allocators.raw);
|
||||
state->allocators.mem = pymem;
|
||||
state->allocators.obj = pyobject;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue