From 969288e488f6d261fbfbab43dcbe6bb6afce28c0 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 26 Jun 2012 09:25:44 +0200 Subject: Use ValueError, not RuntimeError for a utime flag combination illegal on some systems. --- 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 index 776439f..9bedc7d 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -730,7 +730,7 @@ class PosixTester(unittest.TestCase): 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 index 8f2bbfb..82626a8 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -4667,7 +4667,7 @@ posix_utime(PyObject *self, PyObject *args, PyObject *kwargs) #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; -- cgit v0.12