summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 03f795c..101bfbc 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -7431,6 +7431,11 @@ encode_code_page(int code_page,
Py_ssize_t offset;
int chunk_len, ret, done;
+ if (!PyUnicode_Check(unicode)) {
+ PyErr_BadArgument();
+ return NULL;
+ }
+
if (PyUnicode_READY(unicode) == -1)
return NULL;
len = PyUnicode_GET_LENGTH(unicode);
@@ -7504,10 +7509,6 @@ PyUnicode_EncodeCodePage(int code_page,
PyObject *
PyUnicode_AsMBCSString(PyObject *unicode)
{
- if (!PyUnicode_Check(unicode)) {
- PyErr_BadArgument();
- return NULL;
- }
return PyUnicode_EncodeCodePage(CP_ACP, unicode, NULL);
}