gh-107211: No longer export internal variables (#107218)

No longer export these 5 internal C API variables:

* _PyBufferWrapper_Type
* _PyImport_FrozenBootstrap
* _PyImport_FrozenStdlib
* _PyImport_FrozenTest
* _Py_SwappedOp

Fix the definition of these internal functions, replace PyAPI_DATA()
with PyAPI_FUNC():

* _PyImport_ClearExtension()
* _PyObject_IsFreed()
* _PyThreadState_GetCurrent()
This commit is contained in:
Victor Stinner 2023-07-25 05:48:04 +02:00 committed by GitHub
parent c5b13d6f80
commit 3b309319cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 20 deletions

View file

@ -33,7 +33,7 @@ extern void _PyDebugAllocatorStats(FILE *out, const char *block_name,
extern void _PyObject_DebugTypeStats(FILE *out);
// Export for shared _testinternalcapi extension
PyAPI_DATA(int) _PyObject_IsFreed(PyObject *);
PyAPI_FUNC(int) _PyObject_IsFreed(PyObject *);
/* We need to maintain an internal copy of Py{Var}Object_HEAD_INIT to avoid
designated initializer conflicts in C++20. If we use the deinition in
@ -469,11 +469,14 @@ extern PyObject* _PyCFunctionWithKeywords_TrampolineCall(
(meth)((self), (args), (kw))
#endif // __EMSCRIPTEN__ && PY_CALL_TRAMPOLINE
// _pickle shared extension uses _PyNone_Type and _PyNotImplemented_Type
// Export for '_pickle' shared extension
PyAPI_DATA(PyTypeObject) _PyNone_Type;
// Export for '_pickle' shared extension
PyAPI_DATA(PyTypeObject) _PyNotImplemented_Type;
/* Maps Py_LT to Py_GT, ..., Py_GE to Py_LE. Defined in Objects/object.c. */
// Maps Py_LT to Py_GT, ..., Py_GE to Py_LE.
// Defined in Objects/object.c.
// Export for the stable ABI.
PyAPI_DATA(int) _Py_SwappedOp[];
#ifdef __cplusplus