summaryrefslogtreecommitdiffstats
path: root/Include/internal
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-10-31 19:19:24 (GMT)
committerGitHub <noreply@github.com>2018-10-31 19:19:24 (GMT)
commit2be00d987d37682a55db67c298e82c405d01b868 (patch)
treeeffedc3003c8a19764ba20f44a63501e66e58327 /Include/internal
parentb08746bfdf64e55ce33516f2065fa2aa4f51be95 (diff)
downloadcpython-2be00d987d37682a55db67c298e82c405d01b868.zip
cpython-2be00d987d37682a55db67c298e82c405d01b868.tar.gz
cpython-2be00d987d37682a55db67c298e82c405d01b868.tar.bz2
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.
Diffstat (limited to 'Include/internal')
-rw-r--r--Include/internal/mem.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/Include/internal/mem.h b/Include/internal/mem.h
index a731e30..4a41b77 100644
--- a/Include/internal/mem.h
+++ b/Include/internal/mem.h
@@ -4,6 +4,10 @@
extern "C" {
#endif
+#ifndef Py_BUILD_CORE
+# error "Py_BUILD_CORE must be defined to include this header"
+#endif
+
#include "objimpl.h"
#include "pymem.h"
@@ -145,6 +149,14 @@ PyAPI_FUNC(void) _PyGC_Initialize(struct _gc_runtime_state *);
#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
}
#endif