summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-05-18 12:56:25 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-05-18 12:56:25 (GMT)
commit415da6e0b22924e5b4c080cfdbbaed655d6684c7 (patch)
tree9b5f01ad828dba0c082532e894290065a574b634 /Objects
parent9a3a9f779142d92655f86eaf9584ce946c61dfea (diff)
downloadcpython-415da6e0b22924e5b4c080cfdbbaed655d6684c7.zip
cpython-415da6e0b22924e5b4c080cfdbbaed655d6684c7.tar.gz
cpython-415da6e0b22924e5b4c080cfdbbaed655d6684c7.tar.bz2
Only encode Unicode objects when printing them raw.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/fileobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index 40ce759..1cc6def 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -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)