mirror of
https://github.com/python/cpython.git
synced 2025-07-29 14:15:07 +00:00
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
This commit is contained in:
parent
ce55e21c70
commit
0bbbfc4c0b
4 changed files with 42 additions and 3 deletions
|
@ -2137,7 +2137,7 @@ PySet_Add(PyObject *set, PyObject *key)
|
|||
}
|
||||
|
||||
int
|
||||
_PySet_Next(PyObject *set, Py_ssize_t *pos, PyObject **entry)
|
||||
_PySet_Next(PyObject *set, Py_ssize_t *pos, PyObject **key)
|
||||
{
|
||||
setentry *entry_ptr;
|
||||
|
||||
|
@ -2147,7 +2147,23 @@ _PySet_Next(PyObject *set, Py_ssize_t *pos, PyObject **entry)
|
|||
}
|
||||
if (set_next((PySetObject *)set, pos, &entry_ptr) == 0)
|
||||
return 0;
|
||||
*entry = entry_ptr->key;
|
||||
*key = entry_ptr->key;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
_PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, long *hash)
|
||||
{
|
||||
setentry *entry;
|
||||
|
||||
if (!PyAnySet_Check(set)) {
|
||||
PyErr_BadInternalCall();
|
||||
return -1;
|
||||
}
|
||||
if (set_next((PySetObject *)set, pos, &entry) == 0)
|
||||
return 0;
|
||||
*key = entry->key;
|
||||
*hash = entry->hash;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue