Skip to content

Commit 13c90e8

Browse files
authored
Uncomment Py_DEPRECATED for Py_UNICODE APIs (GH-21318)
PyUnicode_EncodeDecimal and PyUnicode_TransformDecimalToASCII are deprecated since Python 3.3. But Py_DEPRECATED(3.3) was commented out.
1 parent 1f76453 commit 13c90e8

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎Include/cpython/unicodeobject.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS(
974974
975975
*/
976976

977-
/* Py_DEPRECATED(3.3) */ PyAPI_FUNC(int) PyUnicode_EncodeDecimal(
977+
Py_DEPRECATED(3.3) PyAPI_FUNC(int) PyUnicode_EncodeDecimal(
978978
Py_UNICODE *s, /* Unicode buffer */
979979
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
980980
char *output, /* Output buffer; must have size >= length */
@@ -987,7 +987,7 @@ Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS(
987987
Returns a new Unicode string on success, NULL on failure.
988988
*/
989989

990-
/* Py_DEPRECATED(3.3) */
990+
Py_DEPRECATED(3.3)
991991
PyAPI_FUNC(PyObject*) PyUnicode_TransformDecimalToASCII(
992992
Py_UNICODE *s, /* Unicode buffer */
993993
Py_ssize_t length /* Number of Py_UNICODE chars to transform */

‎Modules/_testcapimodule.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,6 +2024,10 @@ unicode_copycharacters(PyObject *self, PyObject *args)
20242024
return Py_BuildValue("(Nn)", to_copy, copied);
20252025
}
20262026

2027+
/* Ignore use of deprecated APIs */
2028+
_Py_COMP_DIAG_PUSH
2029+
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
2030+
20272031
static PyObject *
20282032
unicode_encodedecimal(PyObject *self, PyObject *args)
20292033
{
@@ -2069,10 +2073,6 @@ unicode_transformdecimaltoascii(PyObject *self, PyObject *args)
20692073
return PyUnicode_TransformDecimalToASCII(unicode, length);
20702074
}
20712075

2072-
/* Ignore use of deprecated APIs */
2073-
_Py_COMP_DIAG_PUSH
2074-
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
2075-
20762076
static PyObject *
20772077
unicode_legacy_string(PyObject *self, PyObject *args)
20782078
{

0 commit comments

Comments
 (0)