@@ -884,11 +884,11 @@ _Py_CheckRecursiveCall(PyThreadState *tstate, const char *where)
884884// PEP 634: Structural Pattern Matching
885885
886886
887+ // Return a tuple of values corresponding to keys, with error checks for
888+ // duplicate/missing keys.
887889static PyObject *
888890match_keys (PyThreadState * tstate , PyObject * map , PyObject * keys )
889891{
890- // Return a tuple of values corresponding to keys, with error checks for
891- // duplicate/missing keys.
892892 assert (PyTuple_CheckExact (keys ));
893893 Py_ssize_t nkeys = PyTuple_GET_SIZE (keys );
894894 if (!nkeys ) {
@@ -961,13 +961,13 @@ match_keys(PyThreadState *tstate, PyObject *map, PyObject *keys)
961961 return NULL ;
962962}
963963
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.
964967static PyObject *
965968match_class_attr (PyThreadState * tstate , PyObject * subject , PyObject * type ,
966969 PyObject * name , PyObject * seen )
967970{
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.
971971 assert (PyUnicode_CheckExact (name ));
972972 assert (PySet_CheckExact (seen ));
973973 if (PySet_Contains (seen , name ) || PySet_Add (seen , name )) {
@@ -986,12 +986,12 @@ match_class_attr(PyThreadState *tstate, PyObject *subject, PyObject *type,
986986 return attr ;
987987}
988988
989+ // On success (match), return a tuple of extracted attributes. On failure (no
990+ // match), return NULL. Use _PyErr_Occurred(tstate) to disambiguate.
989991static PyObject *
990992match_class (PyThreadState * tstate , PyObject * subject , PyObject * type ,
991993 Py_ssize_t nargs , PyObject * kwargs )
992994{
993- // On success (match), return a tuple of extracted attributes. On failure
994- // (no match), return NULL. Use _PyErr_Occurred(tstate) to disambiguate.
995995 if (!PyType_Check (type )) {
996996 const char * e = "called match pattern must be a type" ;
997997 _PyErr_Format (tstate , PyExc_TypeError , e );
0 commit comments