mirror of
https://github.com/python/cpython.git
synced 2025-09-07 01:11:26 +00:00
Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
I moved the unicode_eq to stringlib/eq.h to keep the function static and possible inline for setobject.c and dictobject.h. I also removed the unused _PyString_Eq method. If it's required in the future it can be added to eq.h
This commit is contained in:
parent
110194048e
commit
0ded5b54bb
7 changed files with 85 additions and 45 deletions
|
@ -877,16 +877,6 @@ string_richcompare(PyStringObject *a, PyStringObject *b, int op)
|
|||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
_PyString_Eq(PyObject *o1, PyObject *o2)
|
||||
{
|
||||
PyStringObject *a = (PyStringObject*) o1;
|
||||
PyStringObject *b = (PyStringObject*) o2;
|
||||
return Py_Size(a) == Py_Size(b)
|
||||
&& *a->ob_sval == *b->ob_sval
|
||||
&& memcmp(a->ob_sval, b->ob_sval, Py_Size(a)) == 0;
|
||||
}
|
||||
|
||||
static long
|
||||
string_hash(PyStringObject *a)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue