]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-144702: Use standard terminology in class pattern error message (#144703)
authorDavid Peter <sharkdp@users.noreply.github.com>
Thu, 19 Feb 2026 13:31:13 +0000 (14:31 +0100)
committerGitHub <noreply@github.com>
Thu, 19 Feb 2026 13:31:13 +0000 (13:31 +0000)
Misc/NEWS.d/next/Core_and_Builtins/2026-02-11-11-28-25.gh-issue-144702.XjFumv.rst [new file with mode: 0644]
Python/ceval.c

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 (file)
index 0000000..01d2b65
--- /dev/null
@@ -0,0 +1,2 @@
+Clarify the error message raised when a class pattern is used to match on a
+non-class object.
index ab2eef560370f5087256307b8d992d73b4f5e1e7..8e905a5e689ed9b15ede2477797daedce4710fd4 100644 (file)
@@ -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;
     }