Tweak at the suggestion of Ezio Melotti for exception messages when

EOF is hit while trying to read the header of a bytecode file.
This commit is contained in:
Brett Cannon 2013-06-04 17:34:49 -04:00
parent 0b81111b18
commit af38f5a503
3 changed files with 2311 additions and 2306 deletions

View File

@ -668,11 +668,11 @@ def _validate_bytecode_header(data, source_stats=None, name=None, path=None):
_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:

View File

@ -10,6 +10,9 @@ What's New in Python 3.4.0 Alpha 1?
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

File diff suppressed because it is too large Load Diff