Commit 415da6e0 authored by Martin v. Löwis's avatar Martin v. Löwis

Only encode Unicode objects when printing them raw.

parent 9a3a9f77
......@@ -2064,7 +2064,8 @@ PyFile_WriteObject(PyObject *v, PyObject *f, int flags)
return -1;
}
#ifdef Py_USING_UNICODE
if (PyUnicode_Check(v) && enc != Py_None) {
if ((flags & Py_PRINT_RAW) &&
PyUnicode_Check(v) && enc != Py_None) {
char *cenc = PyString_AS_STRING(enc);
value = PyUnicode_AsEncodedString(v, cenc, "strict");
if (value == NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment