summaryrefslogtreecommitdiff
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-05-18 12:56:25 +0000
committerMartin v. Löwis <martin@v.loewis.de>2003-05-18 12:56:25 +0000
commit3dcf2db828d981c7a61206771f94d34ab530a31d (patch)
treeba6ec5d8bb1d3db9dd01a690e4fbc7d55736204d /Objects/fileobject.c
parent6be8c0bcd7014d8c04f7e98c8cfe6eacb503b981 (diff)
downloadcpython-3dcf2db828d981c7a61206771f94d34ab530a31d.tar.gz
Only encode Unicode objects when printing them raw.
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r--Objects/fileobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index 40ce759f58..1cc6def62c 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)