Commit d3b5177b authored by Brett Cannon's avatar Brett Cannon

Tweak at the suggestion of Ezio Melotti for exception messages when

EOF is hit while trying to read the header of a bytecode file.
parent 4e4f8433
...@@ -668,11 +668,11 @@ def _validate_bytecode_header(data, source_stats=None, name=None, path=None): ...@@ -668,11 +668,11 @@ def _validate_bytecode_header(data, source_stats=None, name=None, path=None):
_verbose_message(message) _verbose_message(message)
raise ImportError(message, **exc_details) raise ImportError(message, **exc_details)
elif len(raw_timestamp) != 4: 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) _verbose_message(message)
raise EOFError(message) raise EOFError(message)
elif len(raw_size) != 4: 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) _verbose_message(message)
raise EOFError(message) raise EOFError(message)
if source_stats is not None: if source_stats is not None:
......
...@@ -10,6 +10,9 @@ What's New in Python 3.4.0 Alpha 1? ...@@ -10,6 +10,9 @@ What's New in Python 3.4.0 Alpha 1?
Core and Builtins 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 #18065: Don't set __path__ to the package name for frozen packages.
- Issue #18088: When reloading a module, unconditionally reset all relevant - Issue #18088: When reloading a module, unconditionally reset all relevant
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment