summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2001-11-20 15:17:25 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2001-11-20 15:17:25 (GMT)
commit0c4d8d05a8b10c8c611eae0fbe70898050f12ad4 (patch)
tree8f149a365548207fc279143d599306890f2f39c0 /Python
parent4586d2c91c812910d0aae7dfdca75741aacd72b2 (diff)
downloadcpython-0c4d8d05a8b10c8c611eae0fbe70898050f12ad4.zip
cpython-0c4d8d05a8b10c8c611eae0fbe70898050f12ad4.tar.gz
cpython-0c4d8d05a8b10c8c611eae0fbe70898050f12ad4.tar.bz2
Fix for bug #480188: printing unicode objects
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index b707734..21ee3db 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1349,14 +1349,24 @@ eval_frame(PyFrameObject *f)
err = PyFile_WriteString(" ", w);
if (err == 0)
err = PyFile_WriteObject(v, w, Py_PRINT_RAW);
- if (err == 0 && PyString_Check(v)) {
+ if (err == 0) {
/* XXX move into writeobject() ? */
- char *s = PyString_AsString(v);
- int len = PyString_Size(v);
+ if (PyString_Check(v)) {
+ char *s = PyString_AS_STRING(v);
+ int len = PyString_GET_SIZE(v);
if (len > 0 &&
isspace(Py_CHARMASK(s[len-1])) &&
s[len-1] != ' ')
PyFile_SoftSpace(w, 0);
+ }
+ else if (PyUnicode_Check(v)) {
+ Py_UNICODE *s = PyUnicode_AS_UNICODE(v);
+ int len = PyUnicode_GET_SIZE(v);
+ if (len > 0 &&
+ Py_UNICODE_ISSPACE(s[len-1]) &&
+ s[len-1] != ' ')
+ PyFile_SoftSpace(w, 0);
+ }
}
Py_DECREF(v);
Py_XDECREF(stream);