mirror of
https://github.com/python/cpython.git
synced 2025-07-16 07:45:20 +00:00
bpo-31393: Fix the use of PyUnicode_READY(). (#3451)
This commit is contained in:
parent
70c2dd306f
commit
e3b2b4b8d9
5 changed files with 30 additions and 14 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue