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/2012-August/121209.html below:

[Python-Dev] cpython: Fix findnocoding.p and pysource.py scripts

[Python-Dev] cpython: Fix findnocoding.p and pysource.py scripts [Python-Dev] cpython: Fix findnocoding.p and pysource.py scriptsSerhiy Storchaka storchaka at gmail.com
Wed Aug 1 22:52:02 CEST 2012
On 01.08.12 21:16, victor.stinner wrote:
> http://hg.python.org/cpython/rev/67d36e8ddcfc
> changeset:   78375:67d36e8ddcfc
> user:        Victor Stinner <victor.stinner at gmail.com>
> date:        Wed Aug 01 20:12:51 2012 +0200
> summary:
>    Fix findnocoding.p and pysource.py scripts
>
> I suppose that these scripts didn't work since Python 3.0.

> -    line1 = infile.readline()
> -    line2 = infile.readline()
> +    with infile:
> +        line1 = infile.readline()
> +        line2 = infile.readline()
>
> -    if get_declaration(line1) or get_declaration(line2):
> -        # the file does have an encoding declaration, so trust it
> -        infile.close()
> -        return False
> +        if get_declaration(line1) or get_declaration(line2):
> +            # the file does have an encoding declaration, so trust it
> +            infile.close()
> +            return False

infile.close() is unnecessary here.
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