[Python-checkins] cpython: Touch up exception messaging

brett.cannon python-checkins at python.org
Fri Jan 25 19:49:32 CET 2013


http://hg.python.org/cpython/rev/792810303239
changeset:   81735:792810303239
user:        Brett Cannon <brett at python.org>
date:        Fri Jan 25 13:49:19 2013 -0500
summary:
  Touch up exception messaging

files:
  Lib/importlib/_bootstrap.py |     8 +-
  Python/importlib.h          |  5906 +++++++++++-----------
  2 files changed, 2958 insertions(+), 2956 deletions(-)


diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -639,21 +639,21 @@
         exc_details['name'] = name
     else:
         # To prevent having to make all messages have a conditional name.
-        name = 'bytecode'
+        name = '<bytecode>'
     if path is not None:
         exc_details['path'] = path
     magic = data[:4]
     raw_timestamp = data[4:8]
     raw_size = data[8:12]
     if magic != _MAGIC_BYTES:
-        msg = 'bad magic number in {!r}: {!r}'.format(name, magic)
+        msg = 'incomplete magic number in {!r}: {!r}'.format(name, magic)
         raise ImportError(msg, **exc_details)
     elif len(raw_timestamp) != 4:
-        message = 'bad timestamp in {!r}'.format(name)
+        message = 'incomplete timestamp in {!r}'.format(name)
         _verbose_message(message)
         raise EOFError(message)
     elif len(raw_size) != 4:
-        message = 'bad size in {!r}'.format(name)
+        message = 'incomplete size in {!r}'.format(name)
         _verbose_message(message)
         raise EOFError(message)
     if source_stats is not None:
diff --git a/Python/importlib.h b/Python/importlib.h
--- a/Python/importlib.h
+++ b/Python/importlib.h
[stripped]

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


More information about the Python-checkins mailing list