From 26702d01564bed7c4807e7d09d6b85a6a92acb08 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Sun, 16 Apr 2023 14:39:00 +0300 Subject: [PATCH 1/2] gh-100530: Change the error message for `MatchClass` --- .../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 00000000000000..15f035b5ea3e75 --- /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 @@ +Change the error message for ``MatchClass``. diff --git a/Python/ceval.c b/Python/ceval.c index 8c43e3d89c2c2a..d8495da81e94ec 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; } From ad31eb99851a34edeb34d26fa26d36d423e2aa51 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Mon, 17 Apr 2023 23:56:55 +0300 Subject: [PATCH 2/2] Update Misc/NEWS.d/next/Core and Builtins/2023-04-16-14-38-39.gh-issue-100530.OR6-sn.rst Co-authored-by: Brandt Bucher --- .../2023-04-16-14-38-39.gh-issue-100530.OR6-sn.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 15f035b5ea3e75..5b1bcc4a680fc3 100644 --- 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 @@ -1 +1 @@ -Change the error message for ``MatchClass``. +Clarify the error message raised when the called part of a class pattern isn't actually a class.