Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d5914b

Browse files
committed
Fix [ 947405 ] os.utime() raises bad exception for unicode filenames
1 parent 9f1340b commit 2d5914b

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Modules/posixmodule.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2004,8 +2004,13 @@ posix_utime(PyObject *self, PyObject *args)
20042004
Py_END_ALLOW_THREADS
20052005
#endif /* HAVE_UTIMES */
20062006
}
2007-
if (res < 0)
2007+
if (res < 0) {
2008+
#ifdef Py_WIN_WIDE_FILENAMES
2009+
if (have_unicode_filename)
2010+
return posix_error_with_unicode_filename(wpath);
2011+
#endif /* Py_WIN_WIDE_FILENAMES */
20082012
return posix_error_with_filename(path);
2013+
}
20092014
Py_INCREF(Py_None);
20102015
return Py_None;
20112016
#undef UTIME_ARG

0 commit comments

Comments
 (0)