From: Victor Stinner Date: Tue, 29 Aug 2023 03:13:41 +0000 (+0200) Subject: gh-106320: Remove private _PyErr_SetKeyError() (#108607) X-Git-Tag: v3.13.0a1~724 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c9eefc77a7456c5354beaff9bdba449d3e42be35;p=thirdparty%2FPython%2Fcpython.git gh-106320: Remove private _PyErr_SetKeyError() (#108607) Move the private _PyErr_SetKeyError() function to the internal C API (pycore_pyerrors.h). --- diff --git a/Include/cpython/pyerrors.h b/Include/cpython/pyerrors.h index 5c128211bd52..cbe3be158b38 100644 --- a/Include/cpython/pyerrors.h +++ b/Include/cpython/pyerrors.h @@ -88,10 +88,6 @@ typedef PyOSErrorObject PyEnvironmentErrorObject; typedef PyOSErrorObject PyWindowsErrorObject; #endif -/* Error handling definitions */ - -PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *); - /* Context manipulation (PEP 3134) */ Py_DEPRECATED(3.12) PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *); diff --git a/Include/internal/pycore_pyerrors.h b/Include/internal/pycore_pyerrors.h index 5d2ad50e0d2c..0bc20589721f 100644 --- a/Include/internal/pycore_pyerrors.h +++ b/Include/internal/pycore_pyerrors.h @@ -16,6 +16,10 @@ extern PyObject* _PyErr_GetHandledException(PyThreadState *); extern void _PyErr_SetHandledException(PyThreadState *, PyObject *); extern void _PyErr_GetExcInfo(PyThreadState *, PyObject **, PyObject **, PyObject **); +// Export for '_testinternalcapi' shared extension +PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *); + + // Like PyErr_Format(), but saves current exception as __context__ and // __cause__. // Export for '_sqlite3' shared extension. diff --git a/Objects/setobject.c b/Objects/setobject.c index 14b53c12dda5..6051e57731c7 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -36,6 +36,7 @@ #include "pycore_dict.h" // _PyDict_Contains_KnownHash() #include "pycore_modsupport.h" // _PyArg_NoKwnames() #include "pycore_object.h" // _PyObject_GC_UNTRACK() +#include "pycore_pyerrors.h" // _PyErr_SetKeyError() #include "pycore_setobject.h" // _PySet_NextEntry() definition #include // offsetof()