消息 [64157]
Following dirty hack workarounds this bug. Comment of this function
says not ascii compatible encoding is not supported yet, (ie: UTF-16)
so probably this works.
Index: Parser/tokenizer.c
===================================================================
--- Parser/tokenizer.c (revision 61632)
+++ Parser/tokenizer.c (working copy)
@@ -464,6 +464,7 @@
Py_XDECREF(tok->decoding_readline);
readline = PyObject_GetAttrString(stream, "readline");
tok->decoding_readline = readline;
+ tok->lineno = -1; /* dirty hack */
cleanup:
Py_XDECREF(stream);
But if multibyte character is in line like this, its line will not be
printed.
# coding: cp932
# 1
raise RuntimeError("あいうえお")
# 2
C:\Documents and Settings\WhiteRabbit>py3k cp932.py
Traceback (most recent call last):
File "cp932.py", line 3, in <module>
[22819 refs]
This is because Python/trackeback.c 's tb_displayline() assumes
input line is encoded with UTF-8. (simply using FILE structure +
Py_UniversalNewlineFgets)
# http://mail.python.org/pipermail/python-3000/2008-March/012546.html
# sounds nice, if we can replace all FILE structure to Python's own
# fast enough codeced Reader or something. |
|
| 日期 |
用户 |
动作 |
参数 |
| 2008-03-20 06:15:11 | ocean-city | 修改 | spambayes_score: 0.0333877 -> 0.033387706 recipients:
+ ocean-city |
| 2008-03-20 06:15:10 | ocean-city | 修改 | spambayes_score: 0.0333877 -> 0.0333877 messageid: <1205993710.73.0.369658094048.issue2384@psf.upfronthosting.co.za> |
| 2008-03-20 06:15:10 | ocean-city | 链接 | issue2384 messages |
| 2008-03-20 06:15:09 | ocean-city | 创建 | |
|