summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-10-27 18:05:49 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-10-27 18:05:49 (GMT)
commit0093907f0ed88c6aa3561cc4328154ae907bc976 (patch)
treef1a2f717936afa914240619aef371f6232979e77 /Objects/unicodeobject.c
parent802426f99b93e8338c0c3fc6df0b97eb6b211a3e (diff)
downloadcpython-0093907f0ed88c6aa3561cc4328154ae907bc976.zip
cpython-0093907f0ed88c6aa3561cc4328154ae907bc976.tar.gz
cpython-0093907f0ed88c6aa3561cc4328154ae907bc976.tar.bz2
Issue #28426: Deprecated undocumented functions PyUnicode_AsEncodedObject(),
PyUnicode_AsDecodedObject(), PyUnicode_AsDecodedUnicode() and PyUnicode_AsEncodedUnicode().
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 6cf5cb2..e45f3d7 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -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();