Skip to content

Commit eda9ce1

Browse files
authored
gh-106320: Move _PyNone_Type to the internal C API (#107030)
Move private types _PyNone_Type and _PyNotImplemented_Type to internal C API.
1 parent 89f9875 commit eda9ce1

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

Include/cpython/object.h

-3
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,6 @@ PyAPI_FUNC(PyObject *) _PyObject_FunctionStr(PyObject *);
377377
#endif
378378

379379

380-
PyAPI_DATA(PyTypeObject) _PyNone_Type;
381-
PyAPI_DATA(PyTypeObject) _PyNotImplemented_Type;
382-
383380
/* Maps Py_LT to Py_GT, ..., Py_GE to Py_LE.
384381
* Defined in object.c.
385382
*/

Include/internal/pycore_object.h

+4
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,10 @@ extern PyObject* _PyCFunctionWithKeywords_TrampolineCall(
438438
(meth)((self), (args), (kw))
439439
#endif // __EMSCRIPTEN__ && PY_CALL_TRAMPOLINE
440440

441+
// _pickle shared extension uses _PyNone_Type and _PyNotImplemented_Type
442+
PyAPI_DATA(PyTypeObject) _PyNone_Type;
443+
PyAPI_DATA(PyTypeObject) _PyNotImplemented_Type;
444+
441445
#ifdef __cplusplus
442446
}
443447
#endif

Modules/_pickle.c

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "pycore_bytesobject.h" // _PyBytesWriter
1313
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
1414
#include "pycore_moduleobject.h" // _PyModule_GetState()
15+
#include "pycore_object.h" // _PyNone_Type
1516
#include "pycore_pystate.h" // _PyThreadState_GET()
1617
#include "pycore_runtime.h" // _Py_ID()
1718
#include "structmember.h" // PyMemberDef

0 commit comments

Comments
 (0)