mirror of
https://github.com/python/cpython.git
synced 2024-12-12 19:33:52 +08:00
Slight tweak: in string_hash(), if the hash hasn't been computed yet,
and if there's a pointer to an interned version of the string, use its hash and store its hash in this object, rather than recomputing it.
This commit is contained in:
parent
7582bfb60a
commit
36b9f7908a
@ -433,6 +433,11 @@ string_hash(a)
|
||||
#ifdef CACHE_HASH
|
||||
if (a->ob_shash != -1)
|
||||
return a->ob_shash;
|
||||
#ifdef INTERN_STRINGS
|
||||
if (a->ob_sinterned != NULL)
|
||||
return (a->ob_shash =
|
||||
((stringobject *)(a->ob_sinterned))->ob_shash);
|
||||
#endif
|
||||
#endif
|
||||
len = a->ob_size;
|
||||
p = (unsigned char *) a->ob_sval;
|
||||
|
Loading…
Reference in New Issue
Block a user