summaryrefslogtreecommitdiff
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-10-27 21:08:00 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2016-10-27 21:08:00 +0300
commit2edcd1cba499c8bc04e8d8a3e153ccbf7e9eecee (patch)
tree21a49b766716f353e741900d4fd2b5291994e00d /Objects/unicodeobject.c
parent9e7d6a9d5efed11ca35f86a79db026a5a852af56 (diff)
parent0093907f0ed88c6aa3561cc4328154ae907bc976 (diff)
downloadcpython-git-2edcd1cba499c8bc04e8d8a3e153ccbf7e9eecee.tar.gz
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 2a0dc767c2..134fa07600 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -3237,6 +3237,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();
@@ -3256,6 +3261,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();
@@ -3306,6 +3316,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();
@@ -3628,6 +3644,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();