@@ -1782,7 +1782,7 @@ convertenviron(void)
17821782 return NULL ;
17831783 }
17841784#ifdef MS_WINDOWS
1785- v = PyUnicode_FromWideChar (p + 1 , wcslen ( p + 1 ) );
1785+ v = PyUnicode_FromWideChar (p + 1 , -1 );
17861786#else
17871787 v = PyBytes_FromStringAndSize (p + 1 , strlen (p + 1 ));
17881788#endif
@@ -5052,7 +5052,7 @@ os__getfullpathname_impl(PyObject *module, path_t *path)
50525052 return PyErr_NoMemory ();
50535053 }
50545054
5055- PyObject * str = PyUnicode_FromWideChar (abspath , wcslen ( abspath ) );
5055+ PyObject * str = PyUnicode_FromWideChar (abspath , -1 );
50565056 PyMem_RawFree (abspath );
50575057 if (str == NULL ) {
50585058 return NULL ;
@@ -5168,7 +5168,7 @@ os__findfirstfile_impl(PyObject *module, path_t *path)
51685168 }
51695169
51705170 wRealFileName = wFileData .cFileName ;
5171- result = PyUnicode_FromWideChar (wRealFileName , wcslen ( wRealFileName ) );
5171+ result = PyUnicode_FromWideChar (wRealFileName , -1 );
51725172 FindClose (hFindFile );
51735173 return result ;
51745174}
@@ -5212,7 +5212,7 @@ os__getvolumepathname_impl(PyObject *module, path_t *path)
52125212 result = win32_error_object ("_getvolumepathname" , path -> object );
52135213 goto exit ;
52145214 }
5215- result = PyUnicode_FromWideChar (mountpath , wcslen ( mountpath ) );
5215+ result = PyUnicode_FromWideChar (mountpath , -1 );
52165216 if (PyBytes_Check (path -> object ))
52175217 Py_SETREF (result , PyUnicode_EncodeFSDefault (result ));
52185218
0 commit comments