mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
GH-100530: Change the error message for non-class class patterns (GH-103576)
This commit is contained in:
parent
78cac520c3
commit
07804ce24c
2 changed files with 2 additions and 1 deletions
|
@ -0,0 +1 @@
|
||||||
|
Clarify the error message raised when the called part of a class pattern isn't actually a class.
|
|
@ -416,7 +416,7 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type,
|
||||||
Py_ssize_t nargs, PyObject *kwargs)
|
Py_ssize_t nargs, PyObject *kwargs)
|
||||||
{
|
{
|
||||||
if (!PyType_Check(type)) {
|
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);
|
_PyErr_Format(tstate, PyExc_TypeError, e);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue