mirror of
https://github.com/python/cpython.git
synced 2025-10-08 08:01:55 +00:00
[3.6] bpo-31393: Fix the use of PyUnicode_READY(). (GH-3451). (#3453)
(cherry picked from commit e3b2b4b8d9
)
This commit is contained in:
parent
9f2b3d4c28
commit
ddb536ba7b
5 changed files with 30 additions and 15 deletions
|
@ -1464,7 +1464,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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue