8000 bpo-32096: Remove obj and mem from _PyRuntime (#4532) · python/cpython@9e87e77 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9e87e77

Browse files
bpo-32096: Remove obj and mem from _PyRuntime (#4532)
bpo-32096, bpo-30860: Partially revert the commit 2ebc5ce: * Move structures back from Include/internal/mem.h to Objects/obmalloc.c * Remove _PyObject_Initialize() and _PyMem_Initialize() * Remove Include/internal/pymalloc.h * Add test_capi.test_pre_initialization_api(): Make sure that it's possible to call Py_DecodeLocale(), and then call Py_SetProgramName() with the decoded string, before Py_Initialize(). PyMem_RawMalloc() and Py_DecodeLocale() can be called again before _PyRuntimeState_Init(). Co-Authored-By: Eric Snow <ericsnowcurrently@gmail.com>
1 parent 4864a61 commit 9e87e77

File tree

12 files changed

+685
-689
lines changed

12 files changed

+685
-689
lines changed

Include/internal/mem.h

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,6 @@ extern "C" {
77
#include "objimpl.h"
88
#include "pymem.h"
99

10-
#ifdef WITH_PYMALLOC
11-
#include "internal/pymalloc.h"
12-
#endif
13-
14-
/* Low-level memory runtime state */
15-
16-
struct _pymem_runtime_state {
17-
struct _allocator_runtime_state {
18-
PyMemAllocatorEx mem;
19-
PyMemAllocatorEx obj;
20-
PyMemAllocatorEx raw;
21-
} allocators;
22-
#ifdef WITH_PYMALLOC
23-
/* Array of objects used to track chunks of memory (arenas). */
24-
struct arena_object* arenas;
25-
/* The head of the singly-linked, NULL-terminated list of available
26-
arena_objects. */
27-
struct arena_object* unused_arena_objects;
28-
/* The head of the doubly-linked, NULL-terminated at each end,
29-
list of arena_objects associated with arenas that have pools
30-
available. */
31-
struct arena_object* usable_arenas;
32-
/* Number of slots currently allocated in the `arenas` vector. */
33-
unsigned int maxarenas;
34-
/* Number of arenas allocated that haven't been free()'d. */
35-
size_t narenas_currently_allocated;
36-
/* High water mark (max value ever seen) for
37-
* narenas_currently_allocated. */
38-
size_t narenas_highwater;
39-
/* Total number of times malloc() called to allocate an arena. */
40-
size_t ntimes_arena_allocated;
41-
poolp usedpools[MAX_POOLS];
42-
Py_ssize_t num_allocated_blocks;
43-
#endif /* WITH_PYMALLOC */
44-
size_t serialno; /* incremented on each debug {m,re}alloc */
45-
};
46-
47-
PyAPI_FUNC(void) _PyMem_Initialize(struct _pymem_runtime_state *);
48-
49-
50-
/* High-level memory runtime state */
51-
52-
struct _pyobj_runtime_state {
53-
PyObjectArenaAllocator allocator_arenas;
54-
};
55-
56-
PyAPI_FUNC(void) _PyObject_Initialize(struct _pyobj_runtime_state *);
57-
5810

5911
/* GC runtime state */
6012

0 commit comments

Comments
 (0)
0