Skip to content

Commit 1d09916

Browse files
authored
gh-144702: Use standard terminology in class pattern error message (#144703)
1 parent 52794cb commit 1d09916

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Clarify the error message raised when a class pattern is used to match on a
2+
non-class object.

Python/ceval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ _PyEval_MatchClass(PyThreadState *tstate, PyObject *subject, PyObject *type,
534534
Py_ssize_t nargs, PyObject *kwargs)
535535
{
536536
if (!PyType_Check(type)) {
537-
const char *e = "called match pattern must be a class";
537+
const char *e = "class pattern must refer to a class";
538538
_PyErr_Format(tstate, PyExc_TypeError, e);
539539
return NULL;
540540
}

0 commit comments

Comments
 (0)