diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-09-08 09:58:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-08 09:58:51 +0300 |
commit | e3b2b4b8d9e751b49e3550cb83ba39b54fdc377c (patch) | |
tree | e3cf5fd257df7ac82e2bd47811720daf22ce0666 /Modules/socketmodule.c | |
parent | 70c2dd306f575e8bc9edb10ced5c7a6a555d1c87 (diff) | |
download | cpython-git-e3b2b4b8d9e751b49e3550cb83ba39b54fdc377c.tar.gz |
bpo-31393: Fix the use of PyUnicode_READY(). (#3451)
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 2c2f98d4ac..50a4443a35 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1467,7 +1467,10 @@ idna_converter(PyObject *obj, struct maybe_idna *data) len = PyByteArray_Size(obj); } else if (PyUnicode_Check(obj)) { - if (PyUnicode_READY(obj) == 0 && PyUnicode_IS_COMPACT_ASCII(obj)) { + if (PyUnicode_READY(obj) == -1) { + return 0; + } + if (PyUnicode_IS_COMPACT_ASCII(obj)) { data->buf = PyUnicode_DATA(obj); len = PyUnicode_GET_LENGTH(obj); } |