Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 686e880

Browse files
committed
Touch up exception messaging
1 parent 90c8d06 commit 686e880

2 files changed

Lines changed: 2932 additions & 2930 deletions

File tree

Lib/importlib/_bootstrap.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -639,21 +639,21 @@ def _validate_bytecode_header(data, source_stats=None, name=None, path=None):
639639
exc_details['name'] = name
640640
else:
641641
# To prevent having to make all messages have a conditional name.
642-
name = 'bytecode'
642+
name = '<bytecode>'
643643
if path is not None:
644644
exc_details['path'] = path
645645
magic = data[:4]
646646
raw_timestamp = data[4:8]
647647
raw_size = data[8:12]
648648
if magic != _MAGIC_BYTES:
649-
msg = 'bad magic number in {!r}: {!r}'.format(name, magic)
649+
msg = 'incomplete magic number in {!r}: {!r}'.format(name, magic)
650650
raise ImportError(msg, **exc_details)
651651
elif len(raw_timestamp) != 4:
652-
message = 'bad timestamp in {!r}'.format(name)
652+
message = 'incomplete timestamp in {!r}'.format(name)
653653
_verbose_message(message)
654654
raise EOFError(message)
655655
elif len(raw_size) != 4:
656-
message = 'bad size in {!r}'.format(name)
656+
message = 'incomplete size in {!r}'.format(name)
657657
_verbose_message(message)
658658
raise EOFError(message)
659659
if source_stats is not None:

0 commit comments

Comments
 (0)