summaryrefslogtreecommitdiffstats
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r--Objects/fileobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index b29da8a..a7d64ba 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -2394,7 +2394,8 @@ file_init(PyObject *self, PyObject *args, PyObject *kwds)
#ifdef MS_WINDOWS
if (PyArg_ParseTupleAndKeywords(args, kwds, "U|si:file",
- kwlist, &po, &mode, &bufsize)) {
+ kwlist, &po, &mode, &bufsize) &&
+ wcslen(PyUnicode_AS_UNICODE(po)) == (size_t)PyUnicode_GET_SIZE(po)) {
wideargument = 1;
if (fill_file_fields(foself, NULL, po, mode,
fclose) == NULL)