This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients belopolsky, brett.cannon, eli.bendersky, terry.reedy, vstinner
Date 2010-11-08.01:57:11
SpamBayes Score 1.0754435e-09
Marked as misclassified No
Message-id <AANLkTikc-kZ+j1gssBVT1=rbuh7pNtikz+w9oXaZZW=+@mail.gmail.com>
In-reply-to <1289180836.84.0.156023568366.issue10342@psf.upfronthosting.co.za>
Content
On Sun, Nov 7, 2010 at 8:47 PM, STINNER Victor <report@bugs.python.org> wrote:
>
> STINNER Victor <victor.stinner@haypocalc.com> added the comment:
>
> +            try:
> +                with open(filename, 'rb') as fp:
> +                    encoding, _ = tokenize.detect_encoding(fp.readline)
> +            except IOError:
> +                encoding = None
>
> You should use 'utf-8' instead of None (which will fall back to the locale encoding) here.
>

I know.  I was too lazy to look up the correct spelling for the proof
of concept.  I am really posting this patch to show how this bug can
be fixed in theory and discuss how much of refactoring is acceptable.
For example, do we need to preserve trace.find_strings() function?
What is the best way to pass around source code? - file-like objects,
line iterators, readline-like function?  Also compile(prog, filename,
"exec") to find module's bytecode is a hack.  There must be a standard
way to achieve that which would use a .pyc file if available.
History
Date User Action Args
2010-11-08 01:57:29belopolskysetrecipients: + belopolsky, brett.cannon, terry.reedy, vstinner, eli.bendersky
2010-11-08 01:57:13belopolskylinkissue10342 messages
2010-11-08 01:57:11belopolskycreate