mirror of
https://github.com/python/cpython.git
synced 2025-09-19 07:00:59 +00:00
gh-106320: Remove private _PySys functions (#108452)
Move private functions to the internal C API (pycore_sysmodule.h): * _PySys_GetAttr() * _PySys_GetSizeOf() No longer export most of these functions. Fix also a typo in Include/cpython/optimizer.h: add a missing space.
This commit is contained in:
parent
26893016a7
commit
a071ecb4d1
12 changed files with 20 additions and 8 deletions
|
@ -38,7 +38,7 @@ PyAPI_FUNC(void) PyUnstable_SetOptimizer(_PyOptimizerObject* optimizer);
|
||||||
|
|
||||||
PyAPI_FUNC(_PyOptimizerObject *) PyUnstable_GetOptimizer(void);
|
PyAPI_FUNC(_PyOptimizerObject *) PyUnstable_GetOptimizer(void);
|
||||||
|
|
||||||
PyAPI_FUNC(_PyExecutorObject *)PyUnstable_GetExecutor(PyCodeObject *code, int offset);
|
PyAPI_FUNC(_PyExecutorObject *) PyUnstable_GetExecutor(PyCodeObject *code, int offset);
|
||||||
|
|
||||||
struct _PyInterpreterFrame *
|
struct _PyInterpreterFrame *
|
||||||
_PyOptimizer_BackEdge(struct _PyInterpreterFrame *frame, _Py_CODEUNIT *src, _Py_CODEUNIT *dest, PyObject **stack_pointer);
|
_PyOptimizer_BackEdge(struct _PyInterpreterFrame *frame, _Py_CODEUNIT *src, _Py_CODEUNIT *dest, PyObject **stack_pointer);
|
||||||
|
|
|
@ -2,11 +2,6 @@
|
||||||
# error "this header file must not be included directly"
|
# error "this header file must not be included directly"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) _PySys_GetAttr(PyThreadState *tstate,
|
|
||||||
PyObject *name);
|
|
||||||
|
|
||||||
PyAPI_FUNC(size_t) _PySys_GetSizeOf(PyObject *);
|
|
||||||
|
|
||||||
typedef int(*Py_AuditHookFunction)(const char *, PyObject *, void *);
|
typedef int(*Py_AuditHookFunction)(const char *, PyObject *, void *);
|
||||||
|
|
||||||
PyAPI_FUNC(int) PySys_Audit(
|
PyAPI_FUNC(int) PySys_Audit(
|
||||||
|
|
|
@ -8,6 +8,12 @@ extern "C" {
|
||||||
# error "this header requires Py_BUILD_CORE define"
|
# error "this header requires Py_BUILD_CORE define"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Export for '_pickle' shared extension
|
||||||
|
PyAPI_FUNC(PyObject*) _PySys_GetAttr(PyThreadState *tstate, PyObject *name);
|
||||||
|
|
||||||
|
// Export for '_pickle' shared extension
|
||||||
|
PyAPI_FUNC(size_t) _PySys_GetSizeOf(PyObject *);
|
||||||
|
|
||||||
extern int _PySys_Audit(
|
extern int _PySys_Audit(
|
||||||
PyThreadState *tstate,
|
PyThreadState *tstate,
|
||||||
const char *event,
|
const char *event,
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
#include "pycore_object.h"
|
#include "pycore_object.h"
|
||||||
|
#include "pycore_sysmodule.h" // _PySys_GetSizeOf()
|
||||||
|
|
||||||
#include <stddef.h> // offsetof()
|
#include <stddef.h> // offsetof()
|
||||||
#include "_iomodule.h"
|
#include "_iomodule.h"
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,11 @@
|
||||||
#include "pycore_pystate.h" // _PyThreadState_GET()
|
#include "pycore_pystate.h" // _PyThreadState_GET()
|
||||||
#include "pycore_runtime.h" // _Py_ID()
|
#include "pycore_runtime.h" // _Py_ID()
|
||||||
#include "pycore_setobject.h" // _PySet_NextEntry()
|
#include "pycore_setobject.h" // _PySet_NextEntry()
|
||||||
|
#include "pycore_sysmodule.h" // _PySys_GetAttr()
|
||||||
|
|
||||||
#include <stdlib.h> // strtol()
|
#include <stdlib.h> // strtol()
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(pickle_module_doc,
|
PyDoc_STRVAR(pickle_module_doc,
|
||||||
"Optimized C implementation for the Python pickle module.");
|
"Optimized C implementation for the Python pickle module.");
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "pycore_moduleobject.h" // _PyModule_GetState()
|
#include "pycore_moduleobject.h" // _PyModule_GetState()
|
||||||
#include "pycore_pylifecycle.h"
|
#include "pycore_pylifecycle.h"
|
||||||
#include "pycore_pystate.h" // _PyThreadState_SetCurrent()
|
#include "pycore_pystate.h" // _PyThreadState_SetCurrent()
|
||||||
|
#include "pycore_sysmodule.h" // _PySys_GetAttr()
|
||||||
#include "pycore_weakref.h" // _PyWeakref_GET_REF()
|
#include "pycore_weakref.h" // _PyWeakref_GET_REF()
|
||||||
|
|
||||||
#include <stddef.h> // offsetof()
|
#include <stddef.h> // offsetof()
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "pycore_pyerrors.h" // _Py_DumpExtensionModules
|
#include "pycore_pyerrors.h" // _Py_DumpExtensionModules
|
||||||
#include "pycore_pystate.h" // _PyThreadState_GET()
|
#include "pycore_pystate.h" // _PyThreadState_GET()
|
||||||
#include "pycore_signal.h" // Py_NSIG
|
#include "pycore_signal.h" // Py_NSIG
|
||||||
|
#include "pycore_sysmodule.h" // _PySys_GetAttr()
|
||||||
#include "pycore_traceback.h" // _Py_DumpTracebackThreads
|
#include "pycore_traceback.h" // _Py_DumpTracebackThreads
|
||||||
|
|
||||||
#include <object.h>
|
#include <object.h>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include "pycore_pyerrors.h"
|
#include "pycore_pyerrors.h"
|
||||||
#include "pycore_pylifecycle.h" // _Py_IsInterpreterFinalizing()
|
#include "pycore_pylifecycle.h" // _Py_IsInterpreterFinalizing()
|
||||||
#include "pycore_pystate.h" // _PyThreadState_GET()
|
#include "pycore_pystate.h" // _PyThreadState_GET()
|
||||||
|
#include "pycore_sysmodule.h" // _PySys_GetAttr()
|
||||||
|
|
||||||
#include "clinic/_warnings.c.h"
|
#include "clinic/_warnings.c.h"
|
||||||
|
|
||||||
#define MODULE_NAME "_warnings"
|
#define MODULE_NAME "_warnings"
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "pycore_object.h" // _Py_AddToAllObjects()
|
#include "pycore_object.h" // _Py_AddToAllObjects()
|
||||||
#include "pycore_pyerrors.h" // _PyErr_NoMemory()
|
#include "pycore_pyerrors.h" // _PyErr_NoMemory()
|
||||||
#include "pycore_pystate.h" // _PyThreadState_GET()
|
#include "pycore_pystate.h" // _PyThreadState_GET()
|
||||||
|
#include "pycore_sysmodule.h" // _PySys_GetAttr()
|
||||||
#include "pycore_tuple.h" // _PyTuple_FromArray()
|
#include "pycore_tuple.h" // _PyTuple_FromArray()
|
||||||
|
|
||||||
#include "clinic/bltinmodule.c.h"
|
#include "clinic/bltinmodule.c.h"
|
||||||
|
|
|
@ -4,10 +4,11 @@
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
#include "pycore_frame.h"
|
#include "pycore_frame.h"
|
||||||
#include "pycore_function.h"
|
#include "pycore_function.h"
|
||||||
#include "pycore_runtime.h"
|
|
||||||
#include "pycore_global_objects.h"
|
#include "pycore_global_objects.h"
|
||||||
#include "pycore_intrinsics.h"
|
#include "pycore_intrinsics.h"
|
||||||
#include "pycore_pyerrors.h"
|
#include "pycore_pyerrors.h"
|
||||||
|
#include "pycore_runtime.h"
|
||||||
|
#include "pycore_sysmodule.h" // _PySys_GetAttr()
|
||||||
#include "pycore_typevarobject.h"
|
#include "pycore_typevarobject.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ Data members:
|
||||||
#include "pycore_pymem.h" // _PyMem_SetDefaultAllocator()
|
#include "pycore_pymem.h" // _PyMem_SetDefaultAllocator()
|
||||||
#include "pycore_pystate.h" // _PyThreadState_GET()
|
#include "pycore_pystate.h" // _PyThreadState_GET()
|
||||||
#include "pycore_structseq.h" // _PyStructSequence_InitBuiltinWithFlags()
|
#include "pycore_structseq.h" // _PyStructSequence_InitBuiltinWithFlags()
|
||||||
|
#include "pycore_sysmodule.h" // Define _PySys_GetSizeOf()
|
||||||
#include "pycore_tuple.h" // _PyTuple_FromArray()
|
#include "pycore_tuple.h" // _PyTuple_FromArray()
|
||||||
|
|
||||||
#include "frameobject.h" // PyFrame_FastToLocalsWithError()
|
#include "frameobject.h" // PyFrame_FastToLocalsWithError()
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "pycore_pyarena.h" // _PyArena_Free()
|
#include "pycore_pyarena.h" // _PyArena_Free()
|
||||||
#include "pycore_pyerrors.h" // _PyErr_GetRaisedException()
|
#include "pycore_pyerrors.h" // _PyErr_GetRaisedException()
|
||||||
#include "pycore_pystate.h" // _PyThreadState_GET()
|
#include "pycore_pystate.h" // _PyThreadState_GET()
|
||||||
|
#include "pycore_sysmodule.h" // _PySys_GetAttr()
|
||||||
#include "pycore_traceback.h" // EXCEPTION_TB_HEADER
|
#include "pycore_traceback.h" // EXCEPTION_TB_HEADER
|
||||||
|
|
||||||
#include "../Parser/pegen.h" // _PyPegen_byte_offset_to_character_offset()
|
#include "../Parser/pegen.h" // _PyPegen_byte_offset_to_character_offset()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue