From ae3c66acb89a6104fcd0eea760f80a0287327cc4 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Fri, 14 May 2021 05:45:26 +0900 Subject: bpo-44094: Remove deprecated PyErr_ APIs. (GH-26011) These APIs are deprecated since Python 3.3. They are not documented too. --- Include/cpython/pyerrors.h | 18 ----------- .../C API/2021-05-10-14-34-22.bpo-44094.HayXZO.rst | 4 +++ Python/errors.c | 36 ---------------------- 3 files changed, 4 insertions(+), 54 deletions(-) create mode 100644 Misc/NEWS.d/next/C API/2021-05-10-14-34-22.bpo-44094.HayXZO.rst diff --git a/Include/cpython/pyerrors.h b/Include/cpython/pyerrors.h index 37aede0..a3ec5af 100644 --- a/Include/cpython/pyerrors.h +++ b/Include/cpython/pyerrors.h @@ -91,14 +91,6 @@ PyAPI_FUNC(void) _PyErr_GetExcInfo(PyThreadState *, PyObject **, PyObject **, Py PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *); -/* Convenience functions */ - -#ifdef MS_WINDOWS -Py_DEPRECATED(3.3) -PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename( - PyObject *, const Py_UNICODE *); -#endif /* MS_WINDOWS */ - /* Like PyErr_Format(), but saves current exception as __context__ and __cause__. */ @@ -108,16 +100,6 @@ PyAPI_FUNC(PyObject *) _PyErr_FormatFromCause( ... ); -#ifdef MS_WINDOWS -/* XXX redeclare to use WSTRING */ -Py_DEPRECATED(3.3) -PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename( - int, const Py_UNICODE *); -Py_DEPRECATED(3.3) -PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename( - PyObject *,int, const Py_UNICODE *); -#endif - /* In exceptions.c */ /* Helper that attempts to replace the current exception with one of the diff --git a/Misc/NEWS.d/next/C API/2021-05-10-14-34-22.bpo-44094.HayXZO.rst b/Misc/NEWS.d/next/C API/2021-05-10-14-34-22.bpo-44094.HayXZO.rst new file mode 100644 index 0000000..eea9e0b --- /dev/null +++ b/Misc/NEWS.d/next/C API/2021-05-10-14-34-22.bpo-44094.HayXZO.rst @@ -0,0 +1,4 @@ +Remove ``PyErr_SetFromErrnoWithUnicodeFilename()``, +``PyErr_SetFromWindowsErrWithUnicodeFilename()``, and +``PyErr_SetExcFromWindowsErrWithUnicodeFilename()``. They are not documented +and have been deprecated since Python 3.3. diff --git a/Python/errors.c b/Python/errors.c index f743d30..118118f 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -776,17 +776,6 @@ PyErr_SetFromErrnoWithFilename(PyObject *exc, const char *filename) return result; } -#ifdef MS_WINDOWS -PyObject * -PyErr_SetFromErrnoWithUnicodeFilename(PyObject *exc, const Py_UNICODE *filename) -{ - PyObject *name = filename ? PyUnicode_FromWideChar(filename, -1) : NULL; - PyObject *result = PyErr_SetFromErrnoWithFilenameObjects(exc, name, NULL); - Py_XDECREF(name); - return result; -} -#endif /* MS_WINDOWS */ - PyObject * PyErr_SetFromErrno(PyObject *exc) { @@ -887,20 +876,6 @@ PyObject *PyErr_SetExcFromWindowsErrWithFilename( return ret; } -PyObject *PyErr_SetExcFromWindowsErrWithUnicodeFilename( - PyObject *exc, - int ierr, - const Py_UNICODE *filename) -{ - PyObject *name = filename ? PyUnicode_FromWideChar(filename, -1) : NULL; - PyObject *ret = PyErr_SetExcFromWindowsErrWithFilenameObjects(exc, - ierr, - name, - NULL); - Py_XDECREF(name); - return ret; -} - PyObject *PyErr_SetExcFromWindowsErr(PyObject *exc, int ierr) { return PyErr_SetExcFromWindowsErrWithFilename(exc, ierr, NULL); @@ -924,17 +899,6 @@ PyObject *PyErr_SetFromWindowsErrWithFilename( return result; } -PyObject *PyErr_SetFromWindowsErrWithUnicodeFilename( - int ierr, - const Py_UNICODE *filename) -{ - PyObject *name = filename ? PyUnicode_FromWideChar(filename, -1) : NULL; - PyObject *result = PyErr_SetExcFromWindowsErrWithFilenameObjects( - PyExc_OSError, - ierr, name, NULL); - Py_XDECREF(name); - return result; -} #endif /* MS_WINDOWS */ PyObject * -- cgit v0.12