Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d90d5a5a
Commit
d90d5a5a
authored
Nov 20, 2001
by
Marc-André Lemburg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug #480188: printing unicode objects
parent
57e9cbe0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
3 deletions
+39
-3
Lib/test/output/test_unicode
Lib/test/output/test_unicode
+13
-0
Lib/test/test_unicode.py
Lib/test/test_unicode.py
+13
-0
Python/ceval.c
Python/ceval.c
+13
-3
No files found.
Lib/test/output/test_unicode
View file @
d90d5a5a
...
@@ -6,3 +6,16 @@ Testing builtin unicode()... done.
...
@@ -6,3 +6,16 @@ Testing builtin unicode()... done.
Testing builtin codecs... done.
Testing builtin codecs... done.
Testing standard mapping codecs... 0-127... 128-255... done.
Testing standard mapping codecs... 0-127... 128-255... done.
Testing Unicode string concatenation... done.
Testing Unicode string concatenation... done.
Testing Unicode printing... abc
abc def
abc def
abc def
abc
abc
abc
def
def
done.
Lib/test/test_unicode.py
View file @
d90d5a5a
...
@@ -644,3 +644,16 @@ verify((u"abc" "def") == u"abcdef")
...
@@ -644,3 +644,16 @@ verify((u"abc" "def") == u"abcdef")
verify((u"abc" u"def" "ghi") == u"abcdefghi")
verify((u"abc" u"def" "ghi") == u"abcdefghi")
verify(("abc" "def" u"ghi") == u"abcdefghi")
verify(("abc" "def" u"ghi") == u"abcdefghi")
print '
done
.
'
print '
done
.
'
print '
Testing
Unicode
printing
...
',
print u'
abc
'
print u'
abc
', u'
def
'
print u'
abc
', '
def
'
print '
abc
', u'
def
'
print u'
abc
\
n
'
print u'
abc
\
n
',
print u'
abc
\
n
',
print u'
def
\
n
'
print u'
def
\
n
'
print '
done
.
'
Python/ceval.c
View file @
d90d5a5a
...
@@ -1349,15 +1349,25 @@ eval_frame(PyFrameObject *f)
...
@@ -1349,15 +1349,25 @@ eval_frame(PyFrameObject *f)
err
=
PyFile_WriteString
(
" "
,
w
);
err
=
PyFile_WriteString
(
" "
,
w
);
if
(
err
==
0
)
if
(
err
==
0
)
err
=
PyFile_WriteObject
(
v
,
w
,
Py_PRINT_RAW
);
err
=
PyFile_WriteObject
(
v
,
w
,
Py_PRINT_RAW
);
if
(
err
==
0
&&
PyString_Check
(
v
)
)
{
if
(
err
==
0
)
{
/* XXX move into writeobject() ? */
/* XXX move into writeobject() ? */
char
*
s
=
PyString_AsString
(
v
);
if
(
PyString_Check
(
v
))
{
int
len
=
PyString_Size
(
v
);
char
*
s
=
PyString_AS_STRING
(
v
);
int
len
=
PyString_GET_SIZE
(
v
);
if
(
len
>
0
&&
if
(
len
>
0
&&
isspace
(
Py_CHARMASK
(
s
[
len
-
1
]))
&&
isspace
(
Py_CHARMASK
(
s
[
len
-
1
]))
&&
s
[
len
-
1
]
!=
' '
)
s
[
len
-
1
]
!=
' '
)
PyFile_SoftSpace
(
w
,
0
);
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_DECREF
(
v
);
Py_XDECREF
(
stream
);
Py_XDECREF
(
stream
);
stream
=
NULL
;
stream
=
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment