mirror of
https://github.com/python/cpython.git
synced 2025-09-19 07:00:59 +00:00
bpo-35081: Move Py_BUILD_CORE code to internal/mem.h (GH-10249)
* Add #include "internal/mem.h" to C files using _PyMem_SetDefaultAllocator(). * Include/internal/mem.h now requires Py_BUILD_CORE to be defined.
This commit is contained in:
parent
b08746bfdf
commit
2be00d987d
10 changed files with 20 additions and 10 deletions
|
@ -4,6 +4,10 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef Py_BUILD_CORE
|
||||||
|
# error "Py_BUILD_CORE must be defined to include this header"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "objimpl.h"
|
#include "objimpl.h"
|
||||||
#include "pymem.h"
|
#include "pymem.h"
|
||||||
|
|
||||||
|
@ -145,6 +149,14 @@ PyAPI_FUNC(void) _PyGC_Initialize(struct _gc_runtime_state *);
|
||||||
|
|
||||||
#define _PyGC_generation0 _PyRuntime.gc.generation0
|
#define _PyGC_generation0 _PyRuntime.gc.generation0
|
||||||
|
|
||||||
|
|
||||||
|
/* Set the memory allocator of the specified domain to the default.
|
||||||
|
Save the old allocator into *old_alloc if it's non-NULL.
|
||||||
|
Return on success, or return -1 if the domain is unknown. */
|
||||||
|
PyAPI_FUNC(int) _PyMem_SetDefaultAllocator(
|
||||||
|
PyMemAllocatorDomain domain,
|
||||||
|
PyMemAllocatorEx *old_alloc);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -198,16 +198,6 @@ PyAPI_FUNC(void) PyMem_SetAllocator(PyMemAllocatorDomain domain,
|
||||||
PyAPI_FUNC(void) PyMem_SetupDebugHooks(void);
|
PyAPI_FUNC(void) PyMem_SetupDebugHooks(void);
|
||||||
#endif /* Py_LIMITED_API */
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
#ifdef Py_BUILD_CORE
|
|
||||||
/* Set the memory allocator of the specified domain to the default.
|
|
||||||
Save the old allocator into *old_alloc if it's non-NULL.
|
|
||||||
Return on success, or return -1 if the domain is unknown. */
|
|
||||||
PyAPI_FUNC(int) _PyMem_SetDefaultAllocator(
|
|
||||||
PyMemAllocatorDomain domain,
|
|
||||||
PyMemAllocatorEx *old_alloc);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* bpo-35053: expose _Py_tracemalloc_config for performance:
|
/* bpo-35053: expose _Py_tracemalloc_config for performance:
|
||||||
_Py_NewReference() needs an efficient check to test if tracemalloc is
|
_Py_NewReference() needs an efficient check to test if tracemalloc is
|
||||||
tracing.
|
tracing.
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
#include "osdefs.h"
|
#include "osdefs.h"
|
||||||
|
#include "internal/mem.h"
|
||||||
#include "internal/pygetopt.h"
|
#include "internal/pygetopt.h"
|
||||||
#include "internal/pystate.h"
|
#include "internal/pystate.h"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
#include "internal/mem.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
#include "internal/mem.h"
|
||||||
#include "internal/pystate.h"
|
#include "internal/pystate.h"
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#ifdef HAVE_LANGINFO_H
|
#ifdef HAVE_LANGINFO_H
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "Python-ast.h"
|
#include "Python-ast.h"
|
||||||
#undef Yield /* undefine macro conflicting with winbase.h */
|
#undef Yield /* undefine macro conflicting with winbase.h */
|
||||||
#include "internal/hash.h"
|
#include "internal/hash.h"
|
||||||
|
#include "internal/mem.h"
|
||||||
#include "internal/pystate.h"
|
#include "internal/pystate.h"
|
||||||
#include "errcode.h"
|
#include "errcode.h"
|
||||||
#include "marshal.h"
|
#include "marshal.h"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
#include "osdefs.h"
|
#include "osdefs.h"
|
||||||
|
#include "internal/mem.h"
|
||||||
#include "internal/pystate.h"
|
#include "internal/pystate.h"
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#undef Yield /* undefine macro conflicting with winbase.h */
|
#undef Yield /* undefine macro conflicting with winbase.h */
|
||||||
#include "internal/context.h"
|
#include "internal/context.h"
|
||||||
#include "internal/hamt.h"
|
#include "internal/hamt.h"
|
||||||
|
#include "internal/mem.h"
|
||||||
#include "internal/pystate.h"
|
#include "internal/pystate.h"
|
||||||
#include "grammar.h"
|
#include "grammar.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/* Thread and interpreter state structures and their interfaces */
|
/* Thread and interpreter state structures and their interfaces */
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
#include "internal/mem.h"
|
||||||
#include "internal/pystate.h"
|
#include "internal/pystate.h"
|
||||||
|
|
||||||
#define _PyThreadState_SET(value) \
|
#define _PyThreadState_SET(value) \
|
||||||
|
|
|
@ -15,6 +15,7 @@ Data members:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
#include "internal/mem.h"
|
||||||
#include "internal/pystate.h"
|
#include "internal/pystate.h"
|
||||||
#include "code.h"
|
#include "code.h"
|
||||||
#include "frameobject.h"
|
#include "frameobject.h"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue