File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,3 +6,16 @@ Testing builtin unicode()... done.
66Testing builtin codecs... done.
77Testing standard mapping codecs... 0-127... 128-255... done.
88Testing Unicode string concatenation... done.
9+ Testing Unicode printing... abc
10+ abc def
11+ abc def
12+ abc def
13+ abc
14+
15+ abc
16+ abc
17+ def
18+
19+ def
20+
21+ done.
Original file line number Diff line number Diff line change @@ -644,3 +644,16 @@ def __str__(self):
644644verify ((u"abc" u"def" "ghi" ) == u"abcdefghi" )
645645verify (("abc" "def" u"ghi" ) == u"abcdefghi" )
646646print 'done.'
647+
648+ print 'Testing Unicode printing...' ,
649+ print u'abc'
650+ print u'abc' , u'def'
651+ print u'abc' , 'def'
652+ print 'abc' , u'def'
653+ print u'abc\n '
654+ print u'abc\n ' ,
655+ print u'abc\n ' ,
656+ print u'def\n '
657+ print u'def\n '
658+ print 'done.'
659+
Original file line number Diff line number Diff line change @@ -1349,14 +1349,24 @@ eval_frame(PyFrameObject *f)
13491349 err = PyFile_WriteString (" " , w );
13501350 if (err == 0 )
13511351 err = PyFile_WriteObject (v , w , Py_PRINT_RAW );
1352- if (err == 0 && PyString_Check ( v ) ) {
1352+ if (err == 0 ) {
13531353 /* XXX move into writeobject() ? */
1354- char * s = PyString_AsString (v );
1355- int len = PyString_Size (v );
1354+ if (PyString_Check (v )) {
1355+ char * s = PyString_AS_STRING (v );
1356+ int len = PyString_GET_SIZE (v );
13561357 if (len > 0 &&
13571358 isspace (Py_CHARMASK (s [len - 1 ])) &&
13581359 s [len - 1 ] != ' ' )
13591360 PyFile_SoftSpace (w , 0 );
1361+ }
1362+ else if (PyUnicode_Check (v )) {
1363+ Py_UNICODE * s = PyUnicode_AS_UNICODE (v );
1364+ int len = PyUnicode_GET_SIZE (v );
1365+ if (len > 0 &&
1366+ Py_UNICODE_ISSPACE (s [len - 1 ]) &&
1367+ s [len - 1 ] != ' ' )
1368+ PyFile_SoftSpace (w , 0 );
1369+ }
13601370 }
13611371 Py_DECREF (v );
13621372 Py_XDECREF (stream );
You can’t perform that action at this time.
0 commit comments