homepage

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 flox
Recipients flox
Date 2012年06月03日.10:29:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1338719342.67.0.917704298784.issue14990@psf.upfronthosting.co.za>
In-reply-to
Content
I've hit this issue while playing with tokenize for the pep8.py module.
The tokenize detect_encoding() should report SyntaxError when the encoding is improperly declared.
However it raises a LookupError in some cases.
$ ./python -m tokenize Lib/test/bad_coding2.py 
unexpected error: unknown encoding: utf8-sig
Traceback (most recent call last):
 File "./Lib/runpy.py", line 162, in _run_module_as_main
 "__main__", fname, loader, pkg_name)
 File "./Lib/runpy.py", line 75, in _run_code
 exec(code, run_globals)
 File "./Lib/tokenize.py", line 686, in <module>
 main()
 File "./Lib/tokenize.py", line 656, in main
 tokens = list(tokenize(f.readline))
 File "./Lib/tokenize.py", line 489, in _tokenize
 line = line.decode(encoding)
LookupError: unknown encoding: utf8-sig
History
Date User Action Args
2012年06月03日 10:29:02floxsetrecipients: + flox
2012年06月03日 10:29:02floxsetmessageid: <1338719342.67.0.917704298784.issue14990@psf.upfronthosting.co.za>
2012年06月03日 10:29:02floxlinkissue14990 messages
2012年06月03日 10:29:01floxcreate

AltStyle によって変換されたページ (->オリジナル) /