On Fri, Jan 11, 2013 at 9:55 PM, Nick Coghlan <[email protected]> wrote:
> Nice improvement. Just a couple of minor cleanup suggestions.
>
> On Sat, Jan 12, 2013 at 9:09 AM, brett.cannon
> <[email protected]> wrote:
>> + else:
>> + # To prevent having to make all messages have a conditional name.
>> + name = 'bytecode'
>
> For consistency with other default/implied names, I suggest wrapping
> this in angle brackets: "<bytecode>")
Good suggestion.
>
>> + if path is not None:
>> + exc_details['path'] = path
>> + magic = data[:4]
>> + raw_timestamp = data[4:8]
>> + raw_size = data[8:12]
>> + if magic != _MAGIC_BYTES:
>> + msg = 'bad magic number in {!r}: {!r}'.format(name, magic)
>> + raise ImportError(msg, **exc_details)
>> + elif len(raw_timestamp) != 4:
>> + message = 'bad timestamp in {!r}'.format(name)
>> + _verbose_message(message)
>> + raise EOFError(message)
>> + elif len(raw_size) != 4:
>> + message = 'bad size in {!r}'.format(name)
>> + _verbose_message(message)
>> + raise EOFError(message)
>
> For timestamp and size "incomplete" would probably be a better word
> than "bad" in the error messages (since we're only checking the length
> rather than the value).
True. Those were the original messages and in hindsight not accurate.
Since we don't consider exception messages a backwards-compatible
thing I'll update them.
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com