mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Use PyUnicode_AsUnicodeAndSize() instead of PyUnicode_GET_SIZE()
This commit is contained in:
parent
e459a0877e
commit
beac78bb24
3 changed files with 15 additions and 9 deletions
|
@ -2529,10 +2529,9 @@ posix_listdir(PyObject *self, PyObject *args)
|
|||
po_wchars = L".";
|
||||
len = 1;
|
||||
} else {
|
||||
po_wchars = PyUnicode_AsUnicode(po);
|
||||
po_wchars = PyUnicode_AsUnicodeAndSize(po, &len);
|
||||
if (po_wchars == NULL)
|
||||
return NULL;
|
||||
len = PyUnicode_GET_SIZE(po);
|
||||
}
|
||||
/* Overallocate for \\*.*\0 */
|
||||
wnamebuf = malloc((len + 5) * sizeof(wchar_t));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue