summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 30760ed..da0bef0 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -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));