mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
bpo-33299: Return an object itself for some types in _PyCode_ConstantKey(). (GH-6513)
This commit is contained in:
parent
9009f3e389
commit
b7e1eff843
2 changed files with 17 additions and 8 deletions
|
|
@ -5299,10 +5299,12 @@ dict_keys_inorder(PyObject *dict, Py_ssize_t offset)
|
|||
return NULL;
|
||||
while (PyDict_Next(dict, &pos, &k, &v)) {
|
||||
i = PyLong_AS_LONG(v);
|
||||
/* The keys of the dictionary are tuples. (see compiler_add_o
|
||||
* and _PyCode_ConstantKey). The object we want is always second,
|
||||
* though. */
|
||||
k = PyTuple_GET_ITEM(k, 1);
|
||||
/* The keys of the dictionary can be tuples wrapping a contant.
|
||||
* (see compiler_add_o and _PyCode_ConstantKey). In that case
|
||||
* the object we want is always second. */
|
||||
if (PyTuple_CheckExact(k)) {
|
||||
k = PyTuple_GET_ITEM(k, 1);
|
||||
}
|
||||
Py_INCREF(k);
|
||||
assert((i - offset) < size);
|
||||
assert((i - offset) >= 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue