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
a1d14253
Commit
a1d14253
authored
Jan 02, 2019
by
animalize
Committed by
Serhiy Storchaka
Jan 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-35636: Remove redundant check in unicode_hash(). (GH-11402)
_Py_HashBytes() does the check for empty string.
parent
f8b53447
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
10 deletions
+1
-10
Objects/unicodeobject.c
Objects/unicodeobject.c
+1
-10
No files found.
Objects/unicodeobject.c
View file @
a1d14253
...
@@ -11656,7 +11656,6 @@ unicode_getitem(PyObject *self, Py_ssize_t index)
...
@@ -11656,7 +11656,6 @@ unicode_getitem(PyObject *self, Py_ssize_t index)
static
Py_hash_t
static
Py_hash_t
unicode_hash
(
PyObject
*
self
)
unicode_hash
(
PyObject
*
self
)
{
{
Py_ssize_t
len
;
Py_uhash_t
x
;
/* Unsigned for defined overflow behavior. */
Py_uhash_t
x
;
/* Unsigned for defined overflow behavior. */
#ifdef Py_DEBUG
#ifdef Py_DEBUG
...
@@ -11666,15 +11665,7 @@ unicode_hash(PyObject *self)
...
@@ -11666,15 +11665,7 @@ unicode_hash(PyObject *self)
return
_PyUnicode_HASH
(
self
);
return
_PyUnicode_HASH
(
self
);
if
(
PyUnicode_READY
(
self
)
==
-
1
)
if
(
PyUnicode_READY
(
self
)
==
-
1
)
return
-
1
;
return
-
1
;
len
=
PyUnicode_GET_LENGTH
(
self
);
/*
We make the hash of the empty string be 0, rather than using
(prefix ^ suffix), since this slightly obfuscates the hash secret
*/
if
(
len
==
0
)
{
_PyUnicode_HASH
(
self
)
=
0
;
return
0
;
}
x
=
_Py_HashBytes
(
PyUnicode_DATA
(
self
),
x
=
_Py_HashBytes
(
PyUnicode_DATA
(
self
),
PyUnicode_GET_LENGTH
(
self
)
*
PyUnicode_KIND
(
self
));
PyUnicode_GET_LENGTH
(
self
)
*
PyUnicode_KIND
(
self
));
_PyUnicode_HASH
(
self
)
=
x
;
_PyUnicode_HASH
(
self
)
=
x
;
...
...
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