mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-42128: __match_args__ can't be a list anymore (GH-25203)
This commit is contained in:
parent
3d4af4a876
commit
f84d5a1136
4 changed files with 26 additions and 16 deletions
|
@ -1029,15 +1029,8 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type,
|
|||
int match_self = 0;
|
||||
match_args = PyObject_GetAttrString(type, "__match_args__");
|
||||
if (match_args) {
|
||||
if (PyList_CheckExact(match_args)) {
|
||||
Py_SETREF(match_args, PyList_AsTuple(match_args));
|
||||
}
|
||||
if (match_args == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
if (!PyTuple_CheckExact(match_args)) {
|
||||
const char *e = "%s.__match_args__ must be a list or tuple "
|
||||
"(got %s)";
|
||||
const char *e = "%s.__match_args__ must be a tuple (got %s)";
|
||||
_PyErr_Format(tstate, PyExc_TypeError, e,
|
||||
((PyTypeObject *)type)->tp_name,
|
||||
Py_TYPE(match_args)->tp_name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue