@@ -884,11 +884,11 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where)
884
884
// PEP 634: Structural Pattern Matching
885
885
886
886
887
+ // Return a tuple of values corresponding to keys, with error checks for
888
+ // duplicate/missing keys.
887
889
static PyObject *
888
890
match_keys (PyThreadState * tstate , PyObject * map , PyObject * keys )
889
891
{
890
- // Return a tuple of values corresponding to keys, with error checks for
891
- // duplicate/missing keys.
892
892
assert (PyTuple_CheckExact (keys ));
893
893
Py_ssize_t nkeys = PyTuple_GET_SIZE (keys );
894
894
if (!nkeys ) {
@@ -961,13 +961,13 @@ match_keys(PyThreadState *tstate, PyObject *map, PyObject *keys)
961
961
return NULL ;
962
962
}
963
963
964
+ // Extract a named attribute from the subject, with additional bookkeeping to
965
+ // raise TypeErrors for repeated lookups. On failure, return NULL (with no
966
+ // error set). Use _PyErr_Occurred(tstate) to disambiguate.
964
967
static PyObject *
965
968
match_class_attr (PyThreadState * tstate , PyObject * subject , PyObject * type ,
966
969
PyObject * name , PyObject * seen )
967
970
{
968
- // Extract a named attribute from the subject, with additional bookkeeping
969
- // to raise TypeErrors for repeated lookups. On failure, return NULL (with
970
- // no error set). Use _PyErr_Occurred(tstate) to disambiguate.
971
971
assert (PyUnicode_CheckExact (name ));
972
972
assert (PySet_CheckExact (seen ));
973
973
if (PySet_Contains (seen , name ) || PySet_Add (seen , name )) {
@@ -986,12 +986,12 @@ match_class_attr(PyThreadState *tstate, PyObject *subject, PyObject *type,
986
986
return attr ;
987
987
}
988
988
989
+ // On success (match), return a tuple of extracted attributes. On failure (no
990
+ // match), return NULL. Use _PyErr_Occurred(tstate) to disambiguate.
989
991
static PyObject *
990
992
match_class (PyThreadState * tstate , PyObject * subject , PyObject * type ,
991
993
Py_ssize_t nargs , PyObject * kwargs )
992
994
{
993
- // On success (match), return a tuple of extracted attributes. On failure
994
- // (no match), return NULL. Use _PyErr_Occurred(tstate) to disambiguate.
995
995
if (!PyType_Check (type )) {
996
996
const char * e = "called match pattern must be a type" ;
997
997
_PyErr_Format (tstate , PyExc_TypeError , e );
0 commit comments