From 07804ce24c3103ee1bb141af31b9a1a0f92f5e43 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Tue, 18 Apr 2023 20:41:14 +0300 Subject: [PATCH] GH-100530: Change the error message for non-class class patterns (GH-103576) --- .../2023-04-16-14-38-39.gh-issue-100530.OR6-sn.rst | 1 + Python/ceval.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2023-04-16-14-38-39.gh-issue-100530.OR6-sn.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-04-16-14-38-39.gh-issue-100530.OR6-sn.rst b/Misc/NEWS.d/next/Core and Builtins/2023-04-16-14-38-39.gh-issue-100530.OR6-sn.rst new file mode 100644 index 00000000000..5b1bcc4a680 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-04-16-14-38-39.gh-issue-100530.OR6-sn.rst @@ -0,0 +1 @@ +Clarify the error message raised when the called part of a class pattern isn't actually a class. diff --git a/Python/ceval.c b/Python/ceval.c index 8c43e3d89c2..d8495da81e9 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -416,7 +416,7 @@ match_class(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 type"; + const char *e = "called match pattern must be a class"; _PyErr_Format(tstate, PyExc_TypeError, e); return NULL; }