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
00058aa2
Commit
00058aa2
authored
Jul 19, 2007
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a bug in PyUnicode_FromStringAndSize() with signed characters.
parent
814661e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
Objects/unicodeobject.c
Objects/unicodeobject.c
+4
-4
No files found.
Objects/unicodeobject.c
View file @
00058aa2
...
...
@@ -438,13 +438,13 @@ PyObject *PyUnicode_FromStringAndSize(const char *u, Py_ssize_t size)
/* Single characters are shared when using this constructor */
if
(
size
==
1
)
{
unicode
=
unicode_latin1
[
(
int
)
*
u
];
unicode
=
unicode_latin1
[
Py_CHARMASK
(
*
u
)
];
if
(
!
unicode
)
{
unicode
=
_PyUnicode_New
(
1
);
if
(
!
unicode
)
return
NULL
;
unicode
->
str
[
0
]
=
*
u
;
unicode_latin1
[
(
int
)
*
u
]
=
unicode
;
unicode
->
str
[
0
]
=
Py_CHARMASK
(
*
u
)
;
unicode_latin1
[
Py_CHARMASK
(
*
u
)
]
=
unicode
;
}
Py_INCREF
(
unicode
);
return
(
PyObject
*
)
unicode
;
...
...
@@ -459,7 +459,7 @@ PyObject *PyUnicode_FromStringAndSize(const char *u, Py_ssize_t size)
if
(
u
!=
NULL
)
{
Py_UNICODE
*
p
=
unicode
->
str
;
while
(
size
--
)
*
p
++
=
*
u
++
;
*
p
++
=
Py_CHARMASK
(
*
u
++
)
;
/* Don't need to write trailing 0 because
that's already done by _PyUnicode_New */
}
...
...
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