Skip to content

Commit ae3c66a

Browse files
authored
bpo-44094: Remove deprecated PyErr_ APIs. (GH-26011)
These APIs are deprecated since Python 3.3. They are not documented too.
1 parent e0c614e commit ae3c66a

File tree

3 files changed

+4
-54
lines changed

3 files changed

+4
-54
lines changed

Include/cpython/pyerrors.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,6 @@ PyAPI_FUNC(void) _PyErr_GetExcInfo(PyThreadState *, PyObject **, PyObject **, Py
9191

9292
PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
9393

94-
/* Convenience functions */
95-
96-
#ifdef MS_WINDOWS
97-
Py_DEPRECATED(3.3)
98-
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(
99-
PyObject *, const Py_UNICODE *);
100-
#endif /* MS_WINDOWS */
101-
10294
/* Like PyErr_Format(), but saves current exception as __context__ and
10395
__cause__.
10496
*/
@@ -108,16 +100,6 @@ PyAPI_FUNC(PyObject *) _PyErr_FormatFromCause(
108100
...
109101
);
110102

111-
#ifdef MS_WINDOWS
112-
/* XXX redeclare to use WSTRING */
113-
Py_DEPRECATED(3.3)
114-
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename(
115-
int, const Py_UNICODE *);
116-
Py_DEPRECATED(3.3)
117-
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename(
118-
PyObject *,int, const Py_UNICODE *);
119-
#endif
120-
121103
/* In exceptions.c */
122104

123105
/* Helper that attempts to replace the current exception with one of the
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Remove ``PyErr_SetFromErrnoWithUnicodeFilename()``,
2+
``PyErr_SetFromWindowsErrWithUnicodeFilename()``, and
3+
``PyErr_SetExcFromWindowsErrWithUnicodeFilename()``. They are not documented
4+
and have been deprecated since Python 3.3.

Python/errors.c

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -776,17 +776,6 @@ PyErr_SetFromErrnoWithFilename(PyObject *exc, const char *filename)
776776
return result;
777777
}
778778

779-
#ifdef MS_WINDOWS
780-
PyObject *
781-
PyErr_SetFromErrnoWithUnicodeFilename(PyObject *exc, const Py_UNICODE *filename)
782-
{
783-
PyObject *name = filename ? PyUnicode_FromWideChar(filename, -1) : NULL;
784-
PyObject *result = PyErr_SetFromErrnoWithFilenameObjects(exc, name, NULL);
785-
Py_XDECREF(name);
786-
return result;
787-
}
788-
#endif /* MS_WINDOWS */
789-
790779
PyObject *
791780
PyErr_SetFromErrno(PyObject *exc)
792781
{
@@ -887,20 +876,6 @@ PyObject *PyErr_SetExcFromWindowsErrWithFilename(
887876
return ret;
888877
}
889878

890-
PyObject *PyErr_SetExcFromWindowsErrWithUnicodeFilename(
891-
PyObject *exc,
892-
int ierr,
893-
const Py_UNICODE *filename)
894-
{
895-
PyObject *name = filename ? PyUnicode_FromWideChar(filename, -1) : NULL;
896-
PyObject *ret = PyErr_SetExcFromWindowsErrWithFilenameObjects(exc,
897-
ierr,
898-
name,
899-
NULL);
900-
Py_XDECREF(name);
901-
return ret;
902-
}
903-
904879
PyObject *PyErr_SetExcFromWindowsErr(PyObject *exc, int ierr)
905880
{
906881
return PyErr_SetExcFromWindowsErrWithFilename(exc, ierr, NULL);
@@ -924,17 +899,6 @@ PyObject *PyErr_SetFromWindowsErrWithFilename(
924899
return result;
925900
}
926901

927-
PyObject *PyErr_SetFromWindowsErrWithUnicodeFilename(
928-
int ierr,
929-
const Py_UNICODE *filename)
930-
{
931-
PyObject *name = filename ? PyUnicode_FromWideChar(filename, -1) : NULL;
932-
PyObject *result = PyErr_SetExcFromWindowsErrWithFilenameObjects(
933-
PyExc_OSError,
934-
ierr, name, NULL);
935-
Py_XDECREF(name);
936-
return result;
937-
}
938902
#endif /* MS_WINDOWS */
939903

940904
PyObject *

0 commit comments

Comments
 (0)