mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Patch #552433: Special-case tuples. Avoid sub-type checking for lists.
Avoid checks for negative indices and duplicate checks for support of the sequence protocol.
This commit is contained in:
parent
000e37c3c4
commit
01f94bda38
4 changed files with 35 additions and 2 deletions
|
@ -1015,6 +1015,12 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
|||
PySequence_Fast, and that i is within bounds.
|
||||
*/
|
||||
|
||||
#define PySequence_ITEM(o, i)\
|
||||
( o->ob_type->tp_as_sequence->sq_item(o, i) )
|
||||
/* Assume tp_as_sequence and sq_item exist and that i does not
|
||||
need to be corrected for a negative index
|
||||
*/
|
||||
|
||||
DL_IMPORT(int) PySequence_Count(PyObject *o, PyObject *value);
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue