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 Paul.Bonser
Recipients Paul.Bonser
Date 2013-08-28.23:50:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1377733828.84.0.187873686894.issue18873@psf.upfronthosting.co.za>
In-reply-to
Content
lib2to3.pgen2.tokenize:detect_encoding looks for the regex "coding[:=]\s*([-\w.]+)" in the first two lines of the file without first checking if they are comment lines.

You can get 2to3 to fail with "SyntaxError: unknown encoding: 0" with a single line file:

    coding=0

A simple fix would be to check that the line is a comment before trying to look up the encoding from that line.
History
Date User Action Args
2013-08-28 23:50:28Paul.Bonsersetrecipients: + Paul.Bonser
2013-08-28 23:50:28Paul.Bonsersetmessageid: <1377733828.84.0.187873686894.issue18873@psf.upfronthosting.co.za>
2013-08-28 23:50:28Paul.Bonserlinkissue18873 messages
2013-08-28 23:50:28Paul.Bonsercreate