Amaury Forgeot d'Arc added the comment:
Isn't it enough to encode the prompt with the console encoding, instead
of letting the default utf-8 conversion? This patch corrects the issue
on Windows:
Index: ../Python/bltinmodule.c
===================================================================
--- ../Python/bltinmodule.c (revision 59843)
+++ ../Python/bltinmodule.c (working copy)
@@ -1358,12 +1358,19 @@
else
Py_DECREF(tmp);
if (promptarg != NULL) {
- po = PyObject_Str(promptarg);
+ PyObject *stringpo = PyObject_Str(promptarg);
+ if (stringpo == NULL) {
+ Py_DECREF(stdin_encoding);
+ return NULL;
+ }
+ po = PyUnicode_AsEncodedString(stringpo,
+ PyUnicode_AsString(stdin_encoding), NULL);
+ Py_DECREF(stringpo);
if (po == NULL) {
Py_DECREF(stdin_encoding);
return NULL;
}
- prompt = PyUnicode_AsString(po);
+ prompt = PyString_AsString(po);
if (prompt == NULL) {
Py_DECREF(stdin_encoding);
Py_DECREF(po);
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1688>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com