[Python-checkins] cpython: Use ValueError, not RuntimeError for a utime flag combination illegal on some

georg.brandl python-checkins at python.org
Tue Jun 26 09:25:22 CEST 2012


http://hg.python.org/cpython/rev/b2f9e62d7e96
changeset:   77797:b2f9e62d7e96
user:        Georg Brandl <georg at python.org>
date:        Tue Jun 26 09:25:44 2012 +0200
summary:
  Use ValueError, not RuntimeError for a utime flag combination illegal on some systems.

files:
  Lib/test/test_posix.py |  2 +-
  Modules/posixmodule.c  |  2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -730,7 +730,7 @@
             if os.utime in os.supports_follow_symlinks:
                 try:
                     posix.utime(support.TESTFN, follow_symlinks=False, dir_fd=f)
-                except RuntimeError:
+                except ValueError:
                     # whoops!  using both together not supported on this platform.
                     pass
 
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -4667,7 +4667,7 @@
 
 #if !defined(HAVE_UTIMENSAT)
     if ((dir_fd != DEFAULT_DIR_FD) && (!follow_symlinks)) {
-        PyErr_SetString(PyExc_RuntimeError,
+        PyErr_SetString(PyExc_ValueError,
                      "utime: cannot use dir_fd and follow_symlinks "
                      "together on this platform");
         goto exit;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list