Browse Source
bpo-43977: Use tp_flags for collection matching (GH-25723)
bpo-43977: Use tp_flags for collection matching (GH-25723)
* Add Py_TPFLAGS_SEQUENCE and Py_TPFLAGS_MAPPING, add to all relevant standard builtin classes. * Set relevant flags on collections.abc.Sequence and Mapping. * Use flags in MATCH_SEQUENCE and MATCH_MAPPING opcodes. * Inherit Py_TPFLAGS_SEQUENCE and Py_TPFLAGS_MAPPING. * Add NEWS * Remove interpreter-state map_abc and seq_abc fields.pull/25721/head
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 74 additions and 83 deletions
-
4Include/internal/pycore_interp.h
-
7Include/object.h
-
10Lib/_collections_abc.py
-
2Misc/NEWS.d/next/Core and Builtins/2021-04-29-17-40-25.bpo-43977.FrQhge.rst
-
33Modules/_abc.c
-
3Modules/_collectionsmodule.c
-
3Modules/arraymodule.c
-
3Objects/descrobject.c
-
2Objects/dictobject.c
-
2Objects/listobject.c
-
3Objects/memoryobject.c
-
2Objects/rangeobject.c
-
2Objects/tupleobject.c
-
7Objects/typeobject.c
-
72Python/ceval.c
-
2Python/pystate.c
@ -0,0 +1,2 @@ |
|||
Use :c:member:`~PyTypeObject.tp_flags` on the class object to determine if the subject is a sequence |
|||
or mapping when pattern matching. Avoids the need to import :mod:`collections.abc` when pattern matching. |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue