A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-January/123602.html below:

[Python-Dev] [Python-checkins] cpython: Issue #15031: Refactor some code in importlib pertaining to validating

[Python-Dev] [Python-checkins] cpython: Issue #15031: Refactor some code in importlib pertaining to validating [Python-Dev] [Python-checkins] cpython: Issue #15031: Refactor some code in importlib pertaining to validatingNick Coghlan ncoghlan at gmail.com
Sat Jan 12 03:55:25 CET 2013
Nice improvement. Just a couple of minor cleanup suggestions.

On Sat, Jan 12, 2013 at 9:09 AM, brett.cannon
<python-checkins at python.org> 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>")

> +    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).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4