[Python-checkins] gh-106320: Move _PyNone_Type to the internal C API (#107030)
vstinner
webhook-mailer at python.org
Sat Jul 22 10:12:20 EDT 2023
https://github.com/python/cpython/commit/eda9ce148714947c164ff72b720e2645ca2cd5fb
commit: eda9ce148714947c164ff72b720e2645ca2cd5fb
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2023-07-22T14:12:17Z
summary:
gh-106320: Move _PyNone_Type to the internal C API (#107030)
Move private types _PyNone_Type and _PyNotImplemented_Type to
internal C API.
files:
M Include/cpython/object.h
M Include/internal/pycore_object.h
M Modules/_pickle.c
diff --git a/Include/cpython/object.h b/Include/cpython/object.h
index cd421b4f7e0d4..0e5b6acb43b41 100644
--- a/Include/cpython/object.h
+++ b/Include/cpython/object.h
@@ -377,9 +377,6 @@ PyAPI_FUNC(PyObject *) _PyObject_FunctionStr(PyObject *);
#endif
-PyAPI_DATA(PyTypeObject) _PyNone_Type;
-PyAPI_DATA(PyTypeObject) _PyNotImplemented_Type;
-
/* Maps Py_LT to Py_GT, ..., Py_GE to Py_LE.
* Defined in object.c.
*/
diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h
index 2358f48738a90..90588daa64cc3 100644
--- a/Include/internal/pycore_object.h
+++ b/Include/internal/pycore_object.h
@@ -438,6 +438,10 @@ extern PyObject* _PyCFunctionWithKeywords_TrampolineCall(
(meth)((self), (args), (kw))
#endif // __EMSCRIPTEN__ && PY_CALL_TRAMPOLINE
+// _pickle shared extension uses _PyNone_Type and _PyNotImplemented_Type
+PyAPI_DATA(PyTypeObject) _PyNone_Type;
+PyAPI_DATA(PyTypeObject) _PyNotImplemented_Type;
+
#ifdef __cplusplus
}
#endif
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index ea44b494cdd7c..f2e98c10ef718 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -12,6 +12,7 @@
#include "pycore_bytesobject.h" // _PyBytesWriter
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
#include "pycore_moduleobject.h" // _PyModule_GetState()
+#include "pycore_object.h" // _PyNone_Type
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_runtime.h" // _Py_ID()
#include "structmember.h" // PyMemberDef
More information about the Python-checkins
mailing list