mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Touch up exception messaging
This commit is contained in:
parent
90c8d06d68
commit
686e880f20
2 changed files with 2964 additions and 2962 deletions
|
@ -639,21 +639,21 @@ def _validate_bytecode_header(data, source_stats=None, name=None, path=None):
|
||||||
exc_details['name'] = name
|
exc_details['name'] = name
|
||||||
else:
|
else:
|
||||||
# To prevent having to make all messages have a conditional name.
|
# To prevent having to make all messages have a conditional name.
|
||||||
name = 'bytecode'
|
name = '<bytecode>'
|
||||||
if path is not None:
|
if path is not None:
|
||||||
exc_details['path'] = path
|
exc_details['path'] = path
|
||||||
magic = data[:4]
|
magic = data[:4]
|
||||||
raw_timestamp = data[4:8]
|
raw_timestamp = data[4:8]
|
||||||
raw_size = data[8:12]
|
raw_size = data[8:12]
|
||||||
if magic != _MAGIC_BYTES:
|
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)
|
raise ImportError(msg, **exc_details)
|
||||||
elif len(raw_timestamp) != 4:
|
elif len(raw_timestamp) != 4:
|
||||||
message = 'bad timestamp in {!r}'.format(name)
|
message = 'incomplete timestamp 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 = 'bad size in {!r}'.format(name)
|
message = 'incomplete 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:
|
||||||
|
|
5918
Python/importlib.h
5918
Python/importlib.h
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue