https://github.com/python/cpython/commit/a2850a3a91a1515cbdd9440463c78bdf2e0bd3cf
commit: a2850a3a91a1515cbdd9440463c78bdf2e0bd3cf
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2025-10-08T22:33:45+02:00
summary:
gh-70030: Remove _PyCode_ConstantKey() function (#139735)
Move the function to the internal C API and no longer export it.
files:
M Include/cpython/code.h
M Include/internal/pycore_code.h
diff --git a/Include/cpython/code.h b/Include/cpython/code.h
index 3f0dce03455526..84456a709a6abe 100644
--- a/Include/cpython/code.h
+++ b/Include/cpython/code.h
@@ -282,15 +282,6 @@ typedef struct _line_offsets {
*/
PyAPI_FUNC(int) _PyCode_CheckLineNumber(int lasti, PyCodeAddressRange *bounds);
-/* Create a comparable key used to compare constants taking in account the
- * object type. It is used to make sure types are not coerced (e.g., float and
- * complex) _and_ to distinguish 0.0 from -0.0 e.g. on IEEE platforms
- *
- * Return (type(obj), obj, ...): a tuple with variable size (at least 2 items)
- * depending on the type and the value. The type is the first item to not
- * compare bytes and str which can raise a BytesWarning exception. */
-PyAPI_FUNC(PyObject*) _PyCode_ConstantKey(PyObject *obj);
-
PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts,
PyObject *names, PyObject *lnotab);
diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h
index 0ec47f0014bfc0..2d7d81d491c157 100644
--- a/Include/internal/pycore_code.h
+++ b/Include/internal/pycore_code.h
@@ -663,6 +663,15 @@ PyAPI_FUNC(int) _PyCode_VerifyStateless(
PyAPI_FUNC(int) _PyCode_CheckPureFunction(PyCodeObject *, const char **);
PyAPI_FUNC(int) _PyCode_ReturnsOnlyNone(PyCodeObject *);
+/* Create a comparable key used to compare constants taking in account the
+ * object type. It is used to make sure types are not coerced (e.g., float and
+ * complex) _and_ to distinguish 0.0 from -0.0 e.g. on IEEE platforms
+ *
+ * Return (type(obj), obj, ...): a tuple with variable size (at least 2 items)
+ * depending on the type and the value. The type is the first item to not
+ * compare bytes and str which can raise a BytesWarning exception. */
+extern PyObject* _PyCode_ConstantKey(PyObject *obj);
+
#ifdef __cplusplus
}
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]