mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #28426: Deprecated undocumented functions PyUnicode_AsEncodedObject(),
PyUnicode_AsDecodedObject(), PyUnicode_AsDecodedUnicode() and PyUnicode_AsEncodedUnicode().
This commit is contained in:
parent
802426f99b
commit
0093907f0e
4 changed files with 57 additions and 9 deletions
|
@ -3241,6 +3241,11 @@ PyUnicode_AsDecodedObject(PyObject *unicode,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"PyUnicode_AsDecodedObject() is deprecated; "
|
||||
"use PyCodec_Decode() to decode from str", 1) < 0)
|
||||
return NULL;
|
||||
|
||||
if (encoding == NULL)
|
||||
encoding = PyUnicode_GetDefaultEncoding();
|
||||
|
||||
|
@ -3260,6 +3265,11 @@ PyUnicode_AsDecodedUnicode(PyObject *unicode,
|
|||
goto onError;
|
||||
}
|
||||
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"PyUnicode_AsDecodedUnicode() is deprecated; "
|
||||
"use PyCodec_Decode() to decode from str to str", 1) < 0)
|
||||
return NULL;
|
||||
|
||||
if (encoding == NULL)
|
||||
encoding = PyUnicode_GetDefaultEncoding();
|
||||
|
||||
|
@ -3310,6 +3320,12 @@ PyUnicode_AsEncodedObject(PyObject *unicode,
|
|||
goto onError;
|
||||
}
|
||||
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"PyUnicode_AsEncodedObject() is deprecated; "
|
||||
"use PyUnicode_AsEncodedString() to encode from str to bytes "
|
||||
"or PyCodec_Encode() for generic encoding", 1) < 0)
|
||||
return NULL;
|
||||
|
||||
if (encoding == NULL)
|
||||
encoding = PyUnicode_GetDefaultEncoding();
|
||||
|
||||
|
@ -3635,6 +3651,11 @@ PyUnicode_AsEncodedUnicode(PyObject *unicode,
|
|||
goto onError;
|
||||
}
|
||||
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"PyUnicode_AsEncodedUnicode() is deprecated; "
|
||||
"use PyCodec_Encode() to encode from str to str", 1) < 0)
|
||||
return NULL;
|
||||
|
||||
if (encoding == NULL)
|
||||
encoding = PyUnicode_GetDefaultEncoding();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue