Skip to content

Commit c9eefc7

Browse files
authored
gh-106320: Remove private _PyErr_SetKeyError() (#108607)
Move the private _PyErr_SetKeyError() function to the internal C API (pycore_pyerrors.h).
1 parent 921eb8e commit c9eefc7

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Include/cpython/pyerrors.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ typedef PyOSErrorObject PyEnvironmentErrorObject;
8888
typedef PyOSErrorObject PyWindowsErrorObject;
8989
#endif
9090

91-
/* Error handling definitions */
92-
93-
PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *);
94-
9591
/* Context manipulation (PEP 3134) */
9692

9793
Py_DEPRECATED(3.12) PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);

Include/internal/pycore_pyerrors.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ extern PyObject* _PyErr_GetHandledException(PyThreadState *);
1616
extern void _PyErr_SetHandledException(PyThreadState *, PyObject *);
1717
extern void _PyErr_GetExcInfo(PyThreadState *, PyObject **, PyObject **, PyObject **);
1818

19+
// Export for '_testinternalcapi' shared extension
20+
PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *);
21+
22+
1923
// Like PyErr_Format(), but saves current exception as __context__ and
2024
// __cause__.
2125
// Export for '_sqlite3' shared extension.

Objects/setobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "pycore_dict.h" // _PyDict_Contains_KnownHash()
3737
#include "pycore_modsupport.h" // _PyArg_NoKwnames()
3838
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
39+
#include "pycore_pyerrors.h" // _PyErr_SetKeyError()
3940
#include "pycore_setobject.h" // _PySet_NextEntry() definition
4041
#include <stddef.h> // offsetof()
4142

0 commit comments

Comments
 (0)