mirror of
https://github.com/python/cpython.git
synced 2025-12-11 03:20:01 +00:00
gh-107211: No longer export internal functions (4) (#107217)
No longer export these 2 internal C API functions: * _PyEval_SignalAsyncExc() * _PyEval_SignalReceived() Add also comments explaining why some internal functions have to be exported, and update existing comments.
This commit is contained in:
parent
0d0520af83
commit
c5b13d6f80
13 changed files with 29 additions and 15 deletions
|
|
@ -51,6 +51,7 @@ struct atexit_state {
|
||||||
int callback_len;
|
int callback_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Export for '_xxinterpchannels' shared extension
|
||||||
PyAPI_FUNC(int) _Py_AtExit(
|
PyAPI_FUNC(int) _Py_AtExit(
|
||||||
PyInterpreterState *interp,
|
PyInterpreterState *interp,
|
||||||
atexit_datacallbackfunc func,
|
atexit_datacallbackfunc func,
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,14 @@ struct _ceval_runtime_state;
|
||||||
extern void _Py_FinishPendingCalls(PyThreadState *tstate);
|
extern void _Py_FinishPendingCalls(PyThreadState *tstate);
|
||||||
extern void _PyEval_InitState(PyInterpreterState *, PyThread_type_lock);
|
extern void _PyEval_InitState(PyInterpreterState *, PyThread_type_lock);
|
||||||
extern void _PyEval_FiniState(struct _ceval_state *ceval);
|
extern void _PyEval_FiniState(struct _ceval_state *ceval);
|
||||||
PyAPI_FUNC(void) _PyEval_SignalReceived(PyInterpreterState *interp);
|
extern void _PyEval_SignalReceived(PyInterpreterState *interp);
|
||||||
|
// Export for '_testinternalcapi' shared extension
|
||||||
PyAPI_FUNC(int) _PyEval_AddPendingCall(
|
PyAPI_FUNC(int) _PyEval_AddPendingCall(
|
||||||
PyInterpreterState *interp,
|
PyInterpreterState *interp,
|
||||||
int (*func)(void *),
|
int (*func)(void *),
|
||||||
void *arg,
|
void *arg,
|
||||||
int mainthreadonly);
|
int mainthreadonly);
|
||||||
PyAPI_FUNC(void) _PyEval_SignalAsyncExc(PyInterpreterState *interp);
|
extern void _PyEval_SignalAsyncExc(PyInterpreterState *interp);
|
||||||
#ifdef HAVE_FORK
|
#ifdef HAVE_FORK
|
||||||
extern PyStatus _PyEval_ReInitThreads(PyThreadState *tstate);
|
extern PyStatus _PyEval_ReInitThreads(PyThreadState *tstate);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -122,6 +123,7 @@ static inline int _Py_MakeRecCheck(PyThreadState *tstate) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Export for _Py_EnterRecursiveCall()
|
||||||
PyAPI_FUNC(int) _Py_CheckRecursiveCall(
|
PyAPI_FUNC(int) _Py_CheckRecursiveCall(
|
||||||
PyThreadState *tstate,
|
PyThreadState *tstate,
|
||||||
const char *where);
|
const char *where);
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,6 @@ extern int _PyStaticCode_Init(PyCodeObject *co);
|
||||||
|
|
||||||
#ifdef Py_STATS
|
#ifdef Py_STATS
|
||||||
|
|
||||||
|
|
||||||
#define STAT_INC(opname, name) do { if (_py_stats) _py_stats->opcode_stats[opname].specialization.name++; } while (0)
|
#define STAT_INC(opname, name) do { if (_py_stats) _py_stats->opcode_stats[opname].specialization.name++; } while (0)
|
||||||
#define STAT_DEC(opname, name) do { if (_py_stats) _py_stats->opcode_stats[opname].specialization.name--; } while (0)
|
#define STAT_DEC(opname, name) do { if (_py_stats) _py_stats->opcode_stats[opname].specialization.name--; } while (0)
|
||||||
#define OPCODE_EXE_INC(opname) do { if (_py_stats) _py_stats->opcode_stats[opname].execution_count++; } while (0)
|
#define OPCODE_EXE_INC(opname) do { if (_py_stats) _py_stats->opcode_stats[opname].execution_count++; } while (0)
|
||||||
|
|
@ -274,7 +273,7 @@ extern int _PyStaticCode_Init(PyCodeObject *co);
|
||||||
#define EVAL_CALL_STAT_INC_IF_FUNCTION(name, callable) \
|
#define EVAL_CALL_STAT_INC_IF_FUNCTION(name, callable) \
|
||||||
do { if (_py_stats && PyFunction_Check(callable)) _py_stats->call_stats.eval_calls[name]++; } while (0)
|
do { if (_py_stats && PyFunction_Check(callable)) _py_stats->call_stats.eval_calls[name]++; } while (0)
|
||||||
|
|
||||||
// Export for stdlib '_opcode' shared extension
|
// Export for '_opcode' shared extension
|
||||||
PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void);
|
PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,7 @@ extern PyStatus _PyPreCmdline_Read(_PyPreCmdline *cmdline,
|
||||||
|
|
||||||
/* --- PyPreConfig ----------------------------------------------- */
|
/* --- PyPreConfig ----------------------------------------------- */
|
||||||
|
|
||||||
|
// Export for '_testembed' program
|
||||||
PyAPI_FUNC(void) _PyPreConfig_InitCompatConfig(PyPreConfig *preconfig);
|
PyAPI_FUNC(void) _PyPreConfig_InitCompatConfig(PyPreConfig *preconfig);
|
||||||
extern void _PyPreConfig_InitFromConfig(
|
extern void _PyPreConfig_InitFromConfig(
|
||||||
PyPreConfig *preconfig,
|
PyPreConfig *preconfig,
|
||||||
|
|
@ -146,6 +147,7 @@ typedef enum {
|
||||||
_PyConfig_INIT_ISOLATED = 3
|
_PyConfig_INIT_ISOLATED = 3
|
||||||
} _PyConfigInitEnum;
|
} _PyConfigInitEnum;
|
||||||
|
|
||||||
|
// Export for '_testembed' program
|
||||||
PyAPI_FUNC(void) _PyConfig_InitCompatConfig(PyConfig *config);
|
PyAPI_FUNC(void) _PyConfig_InitCompatConfig(PyConfig *config);
|
||||||
extern PyStatus _PyConfig_Copy(
|
extern PyStatus _PyConfig_Copy(
|
||||||
PyConfig *config,
|
PyConfig *config,
|
||||||
|
|
|
||||||
|
|
@ -238,6 +238,7 @@ extern int _PyInterpreterState_IDInitref(PyInterpreterState *);
|
||||||
extern int _PyInterpreterState_IDIncref(PyInterpreterState *);
|
extern int _PyInterpreterState_IDIncref(PyInterpreterState *);
|
||||||
extern void _PyInterpreterState_IDDecref(PyInterpreterState *);
|
extern void _PyInterpreterState_IDDecref(PyInterpreterState *);
|
||||||
|
|
||||||
|
// Export for '_xxsubinterpreters' shared extension
|
||||||
PyAPI_FUNC(PyObject*) _PyInterpreterState_GetMainModule(PyInterpreterState *);
|
PyAPI_FUNC(PyObject*) _PyInterpreterState_GetMainModule(PyInterpreterState *);
|
||||||
|
|
||||||
extern const PyConfig* _PyInterpreterState_GetConfig(PyInterpreterState *interp);
|
extern const PyConfig* _PyInterpreterState_GetConfig(PyInterpreterState *interp);
|
||||||
|
|
@ -253,7 +254,9 @@ extern const PyConfig* _PyInterpreterState_GetConfig(PyInterpreterState *interp)
|
||||||
The caller must hold the GIL.
|
The caller must hold the GIL.
|
||||||
|
|
||||||
Once done with the configuration, PyConfig_Clear() must be called to clear
|
Once done with the configuration, PyConfig_Clear() must be called to clear
|
||||||
it. */
|
it.
|
||||||
|
|
||||||
|
Export for '_testinternalcapi' shared extension. */
|
||||||
PyAPI_FUNC(int) _PyInterpreterState_GetConfigCopy(
|
PyAPI_FUNC(int) _PyInterpreterState_GetConfigCopy(
|
||||||
struct PyConfig *config);
|
struct PyConfig *config);
|
||||||
|
|
||||||
|
|
@ -271,7 +274,9 @@ PyAPI_FUNC(int) _PyInterpreterState_GetConfigCopy(
|
||||||
|
|
||||||
Return 0 on success. Raise an exception and return -1 on error.
|
Return 0 on success. Raise an exception and return -1 on error.
|
||||||
|
|
||||||
The configuration should come from _PyInterpreterState_GetConfigCopy(). */
|
The configuration should come from _PyInterpreterState_GetConfigCopy().
|
||||||
|
|
||||||
|
Export for '_testinternalcapi' shared extension. */
|
||||||
PyAPI_FUNC(int) _PyInterpreterState_SetConfig(
|
PyAPI_FUNC(int) _PyInterpreterState_SetConfig(
|
||||||
const struct PyConfig *config);
|
const struct PyConfig *config);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,16 +10,16 @@ extern "C" {
|
||||||
# error "this header requires Py_BUILD_CORE define"
|
# error "this header requires Py_BUILD_CORE define"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Export for the _xxsubinterpreters shared extension
|
// Export for '_xxsubinterpreters' shared extension
|
||||||
PyAPI_DATA(PyTypeObject) _PyInterpreterID_Type;
|
PyAPI_DATA(PyTypeObject) _PyInterpreterID_Type;
|
||||||
|
|
||||||
// Export for the _xxsubinterpreters shared extension
|
// Export for '_xxsubinterpreters' shared extension
|
||||||
PyAPI_FUNC(PyObject*) _PyInterpreterID_New(int64_t);
|
PyAPI_FUNC(PyObject*) _PyInterpreterID_New(int64_t);
|
||||||
|
|
||||||
// Export for the _xxinterpchannels shared extension
|
// Export for '_xxinterpchannels' shared extension
|
||||||
PyAPI_FUNC(PyObject*) _PyInterpreterState_GetIDObject(PyInterpreterState *);
|
PyAPI_FUNC(PyObject*) _PyInterpreterState_GetIDObject(PyInterpreterState *);
|
||||||
|
|
||||||
// Export for the _testinternalcapi shared extension
|
// Export for '_testinternalcapi' shared extension
|
||||||
PyAPI_FUNC(PyInterpreterState*) _PyInterpreterID_LookUp(PyObject *);
|
PyAPI_FUNC(PyInterpreterState*) _PyInterpreterID_LookUp(PyObject *);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ extern "C" {
|
||||||
|
|
||||||
extern PyTypeObject _PyNamespace_Type;
|
extern PyTypeObject _PyNamespace_Type;
|
||||||
|
|
||||||
|
// Export for '_testmultiphase' shared extension
|
||||||
PyAPI_FUNC(PyObject*) _PyNamespace_New(PyObject *kwds);
|
PyAPI_FUNC(PyObject*) _PyNamespace_New(PyObject *kwds);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
|
|
@ -434,7 +434,8 @@ extern PyObject ** _PyObject_ComputedDictPointer(PyObject *);
|
||||||
extern void _PyObject_FreeInstanceAttributes(PyObject *obj);
|
extern void _PyObject_FreeInstanceAttributes(PyObject *obj);
|
||||||
extern int _PyObject_IsInstanceDictEmpty(PyObject *);
|
extern int _PyObject_IsInstanceDictEmpty(PyObject *);
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, PyObject *);
|
// Export for 'math' shared extension
|
||||||
|
PyAPI_FUNC(PyObject*) _PyObject_LookupSpecial(PyObject *, PyObject *);
|
||||||
|
|
||||||
extern int _PyObject_IsAbstract(PyObject *);
|
extern int _PyObject_IsAbstract(PyObject *);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ extern "C" {
|
||||||
# error "this header requires Py_BUILD_CORE define"
|
# error "this header requires Py_BUILD_CORE define"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Export for '_testinternalcapi' shared extension
|
||||||
PyAPI_FUNC(void) _PyPathConfig_ClearGlobal(void);
|
PyAPI_FUNC(void) _PyPathConfig_ClearGlobal(void);
|
||||||
extern PyStatus _PyPathConfig_ReadGlobal(PyConfig *config);
|
extern PyStatus _PyPathConfig_ReadGlobal(PyConfig *config);
|
||||||
extern PyStatus _PyPathConfig_UpdateGlobal(const PyConfig *config);
|
extern PyStatus _PyPathConfig_UpdateGlobal(const PyConfig *config);
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ PyAPI_FUNC(int) _Py_IsInterpreterFinalizing(PyInterpreterState *interp);
|
||||||
|
|
||||||
/* Random */
|
/* Random */
|
||||||
extern int _PyOS_URandom(void *buffer, Py_ssize_t size);
|
extern int _PyOS_URandom(void *buffer, Py_ssize_t size);
|
||||||
|
// Export for '_random' shared extension
|
||||||
PyAPI_FUNC(int) _PyOS_URandomNonblock(void *buffer, Py_ssize_t size);
|
PyAPI_FUNC(int) _PyOS_URandomNonblock(void *buffer, Py_ssize_t size);
|
||||||
|
|
||||||
/* Legacy locale support */
|
/* Legacy locale support */
|
||||||
|
|
|
||||||
|
|
@ -10,14 +10,14 @@ extern "C" {
|
||||||
|
|
||||||
// Try to get the allocators name set by _PyMem_SetupAllocators().
|
// Try to get the allocators name set by _PyMem_SetupAllocators().
|
||||||
// Return NULL if unknown.
|
// Return NULL if unknown.
|
||||||
// Export for shared _testinternalcapi extension.
|
// Export for '_testinternalcapi' shared extension.
|
||||||
PyAPI_FUNC(const char*) _PyMem_GetCurrentAllocatorName(void);
|
PyAPI_FUNC(const char*) _PyMem_GetCurrentAllocatorName(void);
|
||||||
|
|
||||||
// strdup() using PyMem_RawMalloc()
|
// strdup() using PyMem_RawMalloc()
|
||||||
extern char* _PyMem_RawStrdup(const char *str);
|
extern char* _PyMem_RawStrdup(const char *str);
|
||||||
|
|
||||||
// strdup() using PyMem_Malloc().
|
// strdup() using PyMem_Malloc().
|
||||||
// Export for shared _pickle extension.
|
// Export for '_pickle ' shared extension.
|
||||||
PyAPI_FUNC(char*) _PyMem_Strdup(const char *str);
|
PyAPI_FUNC(char*) _PyMem_Strdup(const char *str);
|
||||||
|
|
||||||
// wcsdup() using PyMem_RawMalloc()
|
// wcsdup() using PyMem_RawMalloc()
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ extern "C" {
|
||||||
|
|
||||||
/* other API */
|
/* other API */
|
||||||
|
|
||||||
PyAPI_FUNC(PyTypeObject *) _PyStructSequence_NewType(
|
// Export for '_curses' shared extension
|
||||||
|
PyAPI_FUNC(PyTypeObject*) _PyStructSequence_NewType(
|
||||||
PyStructSequence_Desc *desc,
|
PyStructSequence_Desc *desc,
|
||||||
unsigned long tp_flags);
|
unsigned long tp_flags);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ extern static_builtin_state * _PyStaticType_GetState(PyInterpreterState *, PyTyp
|
||||||
extern void _PyStaticType_ClearWeakRefs(PyInterpreterState *, PyTypeObject *type);
|
extern void _PyStaticType_ClearWeakRefs(PyInterpreterState *, PyTypeObject *type);
|
||||||
extern void _PyStaticType_Dealloc(PyInterpreterState *, PyTypeObject *);
|
extern void _PyStaticType_Dealloc(PyInterpreterState *, PyTypeObject *);
|
||||||
|
|
||||||
// Export for 'math' shared extension
|
// Export for 'math' shared extension via _PyType_IsReady() function
|
||||||
PyAPI_FUNC(PyObject *) _PyType_GetDict(PyTypeObject *);
|
PyAPI_FUNC(PyObject *) _PyType_GetDict(PyTypeObject *);
|
||||||
extern PyObject * _PyType_GetBases(PyTypeObject *type);
|
extern PyObject * _PyType_GetBases(PyTypeObject *type);
|
||||||
extern PyObject * _PyType_GetMRO(PyTypeObject *type);
|
extern PyObject * _PyType_GetMRO(PyTypeObject *type);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue