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

Skip to content

Commit 969288e

Browse files
committed
Use ValueError, not RuntimeError for a utime flag combination illegal on some systems.
1 parent a4b018f commit 969288e

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/test/test_posix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ def test_utime_dir_fd(self):
730730
if os.utime in os.supports_follow_symlinks:
731731
try:
732732
posix.utime(support.TESTFN, follow_symlinks=False, dir_fd=f)
733-
except RuntimeError:
733+
except ValueError:
734734
# whoops! using both together not supported on this platform.
735735
pass
736736

Modules/posixmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4667,7 +4667,7 @@ posix_utime(PyObject *self, PyObject *args, PyObject *kwargs)
46674667

46684668
#if !defined(HAVE_UTIMENSAT)
46694669
if ((dir_fd != DEFAULT_DIR_FD) && (!follow_symlinks)) {
4670-
PyErr_SetString(PyExc_RuntimeError,
4670+
PyErr_SetString(PyExc_ValueError,
46714671
"utime: cannot use dir_fd and follow_symlinks "
46724672
"together on this platform");
46734673
goto exit;

0 commit comments

Comments
 (0)