summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-04-30 08:50:28 (GMT)
committerGitHub <noreply@github.com>2021-04-30 08:50:28 (GMT)
commit069e81ab3da46c441335ca762c4333b7bd91861d (patch)
tree02716907f4513a812cf2c72309cc4e6f133b3ab3 /Misc
parent2abbd8f2add5e80b86a965625b9a77ae94a101cd (diff)
downloadcpython-069e81ab3da46c441335ca762c4333b7bd91861d.zip
cpython-069e81ab3da46c441335ca762c4333b7bd91861d.tar.gz
cpython-069e81ab3da46c441335ca762c4333b7bd91861d.tar.bz2
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.
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2021-04-29-17-40-25.bpo-43977.FrQhge.rst2
1 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2021-04-29-17-40-25.bpo-43977.FrQhge.rst b/Misc/NEWS.d/next/Core and Builtins/2021-04-29-17-40-25.bpo-43977.FrQhge.rst
new file mode 100644
index 0000000..038d739
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2021-04-29-17-40-25.bpo-43977.FrQhge.rst
@@ -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.