Issue #21715: Extracted shared complicated code in the _io module to new
_PyErr_ChainExceptions() function.
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
index e44fb5f..02f65d6 100644
--- a/Include/pyerrors.h
+++ b/Include/pyerrors.h
@@ -123,7 +123,9 @@
 /* Context manipulation (PEP 3134) */
 PyAPI_FUNC(PyObject *) PyException_GetContext(PyObject *);
 PyAPI_FUNC(void) PyException_SetContext(PyObject *, PyObject *);
-
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
+#endif
 
 /* */