[Python-checkins] gh-106320: Remove _Py_SwappedOp from the C API (#107036)

vstinner webhook-mailer at python.org
Sat Jul 22 12:07:11 EDT 2023


https://github.com/python/cpython/commit/6fbc717214210e06313a283b2f3ec8ce67209609
commit: 6fbc717214210e06313a283b2f3ec8ce67209609
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2023-07-22T16:07:07Z
summary:

gh-106320: Remove _Py_SwappedOp from the C API (#107036)

Move _Py_SwappedOp to the internal C API (pycore_object.h).

files:
M Include/cpython/object.h
M Include/internal/pycore_object.h
M Objects/object.c

diff --git a/Include/cpython/object.h b/Include/cpython/object.h
index 0e5b6acb43b41..49101c1875686 100644
--- a/Include/cpython/object.h
+++ b/Include/cpython/object.h
@@ -377,11 +377,6 @@ PyAPI_FUNC(PyObject *) _PyObject_FunctionStr(PyObject *);
 #endif
 
 
-/* Maps Py_LT to Py_GT, ..., Py_GE to Py_LE.
- * Defined in object.c.
- */
-PyAPI_DATA(int) _Py_SwappedOp[];
-
 PyAPI_FUNC(void)
 _PyDebugAllocatorStats(FILE *out, const char *block_name, int num_blocks,
                        size_t sizeof_block);
diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h
index 90588daa64cc3..a9c996557430a 100644
--- a/Include/internal/pycore_object.h
+++ b/Include/internal/pycore_object.h
@@ -442,6 +442,9 @@ extern PyObject* _PyCFunctionWithKeywords_TrampolineCall(
 PyAPI_DATA(PyTypeObject) _PyNone_Type;
 PyAPI_DATA(PyTypeObject) _PyNotImplemented_Type;
 
+/* Maps Py_LT to Py_GT, ..., Py_GE to Py_LE.  Defined in Objects/object.c. */
+PyAPI_DATA(int) _Py_SwappedOp[];
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/Objects/object.c b/Objects/object.c
index bfbc87198f5b3..3b8839b877261 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -9,7 +9,7 @@
 #include "pycore_floatobject.h"   // _PyFloat_DebugMallocStats()
 #include "pycore_initconfig.h"    // _PyStatus_EXCEPTION()
 #include "pycore_namespace.h"     // _PyNamespace_Type
-#include "pycore_object.h"        // _PyType_CheckConsistency(), _Py_FatalRefcountError()
+#include "pycore_object.h"        // PyAPI_DATA() _Py_SwappedOp definition
 #include "pycore_pyerrors.h"      // _PyErr_Occurred()
 #include "pycore_pymem.h"         // _PyMem_IsPtrFreed()
 #include "pycore_pystate.h"       // _PyThreadState_GET()



More information about the Python-checkins mailing list