[Python-checkins] cpython: Tweak at the suggestion of Ezio Melotti for exception messages when

brett.cannon python-checkins at python.org
Tue Jun 4 23:36:16 CEST 2013


http://hg.python.org/cpython/rev/9e833c1edeb6
changeset:   84023:9e833c1edeb6
parent:      84020:2472603af83e
user:        Brett Cannon <brett at python.org>
date:        Tue Jun 04 17:34:49 2013 -0400
summary:
  Tweak at the suggestion of Ezio Melotti for exception messages when
EOF is hit while trying to read the header of a bytecode file.

files:
  Lib/importlib/_bootstrap.py |     4 +-
  Misc/NEWS                   |     3 +
  Python/importlib.h          |  4610 +++++++++++-----------
  3 files changed, 2311 insertions(+), 2306 deletions(-)


diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -668,11 +668,11 @@
         _verbose_message(message)
         raise ImportError(message, **exc_details)
     elif len(raw_timestamp) != 4:
-        message = 'incomplete timestamp in {!r}'.format(name)
+        message = 'reached EOF while reading magic number in {!r}'.format(name)
         _verbose_message(message)
         raise EOFError(message)
     elif len(raw_size) != 4:
-        message = 'incomplete size in {!r}'.format(name)
+        message = 'reached EOF while reading size in {!r}'.format(name)
         _verbose_message(message)
         raise EOFError(message)
     if source_stats is not None:
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@
 Core and Builtins
 -----------------
 
+- Tweak the exception message when the magic number or size value in a bytecode
+  file is truncated.
+
 - Issue #18065: Don't set __path__ to the package name for frozen packages.
 
 - Issue #18088: When reloading a module, unconditionally reset all relevant
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