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
77bb47b3
Commit
77bb47b3
authored
Oct 03, 2011
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify unicode_resizable(): singletons reference count is at least 2
parent
8619cd73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
13 deletions
+7
-13
Objects/unicodeobject.c
Objects/unicodeobject.c
+7
-13
No files found.
Objects/unicodeobject.c
View file @
77bb47b3
...
...
@@ -1257,26 +1257,20 @@ unicode_dealloc(register PyUnicodeObject *unicode)
static
int
unicode_resizable
(
PyObject
*
unicode
)
{
Py_ssize_t
len
;
if
(
Py_REFCNT
(
unicode
)
!=
1
)
return
0
;
if
(
PyUnicode_CHECK_INTERNED
(
unicode
))
return
0
;
if
(
unicode
==
unicode_empty
)
return
0
;
if
(
_PyUnicode_KIND
(
unicode
)
==
PyUnicode_WCHAR_KIND
)
len
=
PyUnicode_WSTR_LENGTH
(
unicode
);
else
len
=
PyUnicode_GET_LENGTH
(
unicode
);
if
(
len
==
1
)
{
Py_UCS4
ch
;
if
(
_PyUnicode_KIND
(
unicode
)
==
PyUnicode_WCHAR_KIND
)
ch
=
_PyUnicode_WSTR
(
unicode
)[
0
];
else
ch
=
PyUnicode_READ_CHAR
(
unicode
,
0
);
assert
(
unicode
!=
unicode_empty
);
#ifdef Py_DEBUG
if
(
_PyUnicode_KIND
(
unicode
)
!=
PyUnicode_WCHAR_KIND
&&
PyUnicode_GET_LENGTH
(
unicode
)
==
1
)
{
Py_UCS4
ch
=
PyUnicode_READ_CHAR
(
unicode
,
0
);
if
(
ch
<
256
&&
unicode_latin1
[
ch
]
==
unicode
)
return
0
;
}
#endif
return
1
;
}
...
...
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