summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-12-06 16:26:10 (GMT)
committerGitHub <noreply@github.com>2017-12-06 16:26:10 (GMT)
commit6bf992a1ac6f3f4d0f83ead9c6403a76afdbe6eb (patch)
tree592a2085a4d49a5fc394e96b4e3b57d25d82b38a /Include
parent672b6baa71010f236ee8c8ce912e98cb542385c6 (diff)
downloadcpython-6bf992a1ac6f3f4d0f83ead9c6403a76afdbe6eb.zip
cpython-6bf992a1ac6f3f4d0f83ead9c6403a76afdbe6eb.tar.gz
cpython-6bf992a1ac6f3f4d0f83ead9c6403a76afdbe6eb.tar.bz2
bpo-32030: Add pymain_get_global_config() (#4735)
* Py_Main() now starts by reading Py_xxx configuration variables to only work on its own private structure, and then later writes back the configuration into these variables. * Replace Py_GETENV() with pymain_get_env_var() which ignores empty variables. * Add _PyCoreConfig.dump_refs * Add _PyCoreConfig.malloc_stats * _PyObject_DebugMallocStats() is now responsible to check if debug hooks are installed. The function returns 1 if stats were written, or 0 if the hooks are disabled. Mark _PyMem_PymallocEnabled() as static.
Diffstat (limited to 'Include')
-rw-r--r--Include/objimpl.h2
-rw-r--r--Include/pymem.h4
-rw-r--r--Include/pystate.h10
3 files changed, 7 insertions, 9 deletions
diff --git a/Include/objimpl.h b/Include/objimpl.h
index 746f9c9..ed9e7a9 100644
--- a/Include/objimpl.h
+++ b/Include/objimpl.h
@@ -109,7 +109,7 @@ PyAPI_FUNC(Py_ssize_t) _Py_GetAllocatedBlocks(void);
/* Macros */
#ifdef WITH_PYMALLOC
#ifndef Py_LIMITED_API
-PyAPI_FUNC(void) _PyObject_DebugMallocStats(FILE *out);
+PyAPI_FUNC(int) _PyObject_DebugMallocStats(FILE *out);
#endif /* #ifndef Py_LIMITED_API */
#endif
diff --git a/Include/pymem.h b/Include/pymem.h
index 09d1502..8ee0efd 100644
--- a/Include/pymem.h
+++ b/Include/pymem.h
@@ -24,10 +24,6 @@ PyAPI_FUNC(int) _PyMem_SetupAllocators(const char *opt);
/* Try to get the allocators name set by _PyMem_SetupAllocators(). */
PyAPI_FUNC(const char*) _PyMem_GetAllocatorsName(void);
-#ifdef WITH_PYMALLOC
-PyAPI_FUNC(int) _PyMem_PymallocEnabled(void);
-#endif
-
/* Track an allocated memory block in the tracemalloc module.
Return 0 on success, return -1 on error (failed to allocate memory to store
the trace).
diff --git a/Include/pystate.h b/Include/pystate.h
index cf45b05..d149aeb 100644
--- a/Include/pystate.h
+++ b/Include/pystate.h
@@ -36,6 +36,8 @@ typedef struct {
int import_time; /* -X importtime */
int show_ref_count; /* -X showrefcount */
int show_alloc_count; /* -X showalloccount */
+ int dump_refs; /* PYTHONDUMPREFS */
+ int malloc_stats; /* PYTHONMALLOCSTATS */
} _PyCoreConfig;
#define _PyCoreConfig_INIT (_PyCoreConfig){.use_hash_seed = -1}
@@ -111,7 +113,7 @@ typedef struct _is {
PyObject *after_forkers_child;
#endif
} PyInterpreterState;
-#endif
+#endif /* !Py_LIMITED_API */
/* State unique per thread */
@@ -133,7 +135,7 @@ typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *);
#define PyTrace_C_EXCEPTION 5
#define PyTrace_C_RETURN 6
#define PyTrace_OPCODE 7
-#endif
+#endif /* Py_LIMITED_API */
#ifdef Py_LIMITED_API
typedef struct _ts PyThreadState;
@@ -238,7 +240,7 @@ typedef struct _ts {
/* XXX signal handlers should also be here */
} PyThreadState;
-#endif
+#endif /* !Py_LIMITED_API */
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void);
@@ -363,7 +365,7 @@ PyAPI_FUNC(int) PyGILState_Check(void);
Return NULL before _PyGILState_Init() is called and after _PyGILState_Fini()
is called. */
PyAPI_FUNC(PyInterpreterState *) _PyGILState_GetInterpreterStateUnsafe(void);
-#endif
+#endif /* !Py_LIMITED_API */
/* The implementation of sys._current_frames() Returns a dict mapping