[Python-checkins] bpo-41098: Doc: Add missing deprecated directives (GH-21162)

Miss Islington (bot) webhook-mailer at python.org
Fri Aug 7 03:49:58 EDT 2020


https://github.com/python/cpython/commit/dc98a5468a48ecffe95a6c3a07ce21366477bdd7
commit: dc98a5468a48ecffe95a6c3a07ce21366477bdd7
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-08-07T00:49:46-07:00
summary:

bpo-41098: Doc: Add missing deprecated directives (GH-21162)


PyUnicodeEncodeError_Create has been deprecated with
`Py_DEPRECATED` macro. But it was not documented.
(cherry picked from commit 46e19b61d31ba99f049258efa4ff1334856a3643)

Co-authored-by: Inada Naoki <songofacandy at gmail.com>

files:
M Doc/c-api/exceptions.rst
M Include/cpython/pyerrors.h

diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index 85a3d941ed8c1..bbc1ee28d9b08 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -635,11 +635,21 @@ The following functions are used to create and modify Unicode exceptions from C.
    *object*, *length*, *start*, *end* and *reason*. *encoding* and *reason* are
    UTF-8 encoded strings.
 
+   .. deprecated:: 3.3 3.11
+
+      ``Py_UNICODE`` is deprecated since Python 3.3. Please migrate to
+      ``PyObject_CallFunction(PyExc_UnicodeEncodeError, "sOnns", ...)``.
+
 .. c:function:: PyObject* PyUnicodeTranslateError_Create(const Py_UNICODE *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason)
 
    Create a :class:`UnicodeTranslateError` object with the attributes *object*,
    *length*, *start*, *end* and *reason*. *reason* is a UTF-8 encoded string.
 
+   .. deprecated:: 3.3 3.11
+
+      ``Py_UNICODE`` is deprecated since Python 3.3. Please migrate to
+      ``PyObject_CallFunction(PyExc_UnicodeTranslateError, "Onns", ...)``.
+
 .. c:function:: PyObject* PyUnicodeDecodeError_GetEncoding(PyObject *exc)
                 PyObject* PyUnicodeEncodeError_GetEncoding(PyObject *exc)
 
diff --git a/Include/cpython/pyerrors.h b/Include/cpython/pyerrors.h
index e3098b3925bd7..418f48a7e2bae 100644
--- a/Include/cpython/pyerrors.h
+++ b/Include/cpython/pyerrors.h
@@ -148,7 +148,10 @@ PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject(
     PyObject *filename,
     int lineno);
 
-/* Create a UnicodeEncodeError object */
+/* Create a UnicodeEncodeError object.
+ *
+ * TODO: This API will be removed in Python 3.11.
+ */
 Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create(
     const char *encoding,       /* UTF-8 encoded string */
     const Py_UNICODE *object,
@@ -158,7 +161,10 @@ Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create(
     const char *reason          /* UTF-8 encoded string */
     );
 
-/* Create a UnicodeTranslateError object */
+/* Create a UnicodeTranslateError object.
+ *
+ * TODO: This API will be removed in Python 3.11.
+ */
 Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create(
     const Py_UNICODE *object,
     Py_ssize_t length,



More information about the Python-checkins mailing list