summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/util.py
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2014-03-12 07:34:02 (GMT)
committerÉric Araujo <merwok@netwok.org>2014-03-12 07:34:02 (GMT)
commitfc773a2d4ba3810b982e703bf8a240206369e5d1 (patch)
tree7d1428117d5ec01e94cdba671e35755cf9462a3e /Lib/distutils/util.py
parented5d95b76bd9a3584038bf578bac8f473a47e4c4 (diff)
downloadcpython-fc773a2d4ba3810b982e703bf8a240206369e5d1.zip
cpython-fc773a2d4ba3810b982e703bf8a240206369e5d1.tar.gz
cpython-fc773a2d4ba3810b982e703bf8a240206369e5d1.tar.bz2
Avoid “error: None” messages from distutils (#4931).
Thanks to Amaury Forgeot d’Arc and Philip J. Eby.
Diffstat (limited to 'Lib/distutils/util.py')
-rw-r--r--Lib/distutils/util.py23
1 files changed, 4 insertions, 19 deletions
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py
index 67d8166..b558957 100644
--- a/Lib/distutils/util.py
+++ b/Lib/distutils/util.py
@@ -213,25 +213,10 @@ def subst_vars (s, local_vars):
def grok_environment_error (exc, prefix="error: "):
- """Generate a useful error message from an EnvironmentError (IOError or
- OSError) exception object. Handles Python 1.5.1 and 1.5.2 styles, and
- does what it can to deal with exception objects that don't have a
- filename (which happens when the error is due to a two-file operation,
- such as 'rename()' or 'link()'. Returns the error message as a string
- prefixed with 'prefix'.
- """
- # check for Python 1.5.2-style {IO,OS}Error exception objects
- if hasattr(exc, 'filename') and hasattr(exc, 'strerror'):
- if exc.filename:
- error = prefix + "%s: %s" % (exc.filename, exc.strerror)
- else:
- # two-argument functions in posix module don't
- # include the filename in the exception object!
- error = prefix + "%s" % exc.strerror
- else:
- error = prefix + str(exc.args[-1])
-
- return error
+ # Function kept for backward compatibility.
+ # Used to try clever things with EnvironmentErrors,
+ # but nowadays str(exception) produces good messages.
+ return prefix + str(exc)
# Needed by 'split_quoted()'