消息 [162205]
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 |
|
| 日期 |
用户 |
动作 |
参数 |
| 2012-06-03 10:29:02 | flox | 修改 | recipients:
+ flox |
| 2012-06-03 10:29:02 | flox | 修改 | messageid: <1338719342.67.0.917704298784.issue14990@psf.upfronthosting.co.za> |
| 2012-06-03 10:29:02 | flox | 链接 | issue14990 messages |
| 2012-06-03 10:29:01 | flox | 创建 | |
|