From: David Peter Date: Thu, 19 Feb 2026 13:31:13 +0000 (+0100) Subject: gh-144702: Use standard terminology in class pattern error message (#144703) X-Git-Tag: v3.15.0a7~225 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1d099164bc0732debb9e93f32ad96a7d3d55a9ba;p=thirdparty%2FPython%2Fcpython.git gh-144702: Use standard terminology in class pattern error message (#144703) --- diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-02-11-11-28-25.gh-issue-144702.XjFumv.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-02-11-11-28-25.gh-issue-144702.XjFumv.rst new file mode 100644 index 000000000000..01d2b6570ded --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-02-11-11-28-25.gh-issue-144702.XjFumv.rst @@ -0,0 +1,2 @@ +Clarify the error message raised when a class pattern is used to match on a +non-class object. diff --git a/Python/ceval.c b/Python/ceval.c index ab2eef560370..8e905a5e689e 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -534,7 +534,7 @@ _PyEval_MatchClass(PyThreadState *tstate, PyObject *subject, PyObject *type, Py_ssize_t nargs, PyObject *kwargs) { if (!PyType_Check(type)) { - const char *e = "called match pattern must be a class"; + const char *e = "class pattern must refer to a class"; _PyErr_Format(tstate, PyExc_TypeError, e); return NULL; }