mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-43413: Fix handling keyword arguments in subclasses of some buitin classes (GH-26456)
* Constructors of subclasses of some buitin classes (e.g. tuple, list, frozenset) no longer accept arbitrary keyword arguments. * Subclass of set can now define a __new__() method with additional keyword parameters without overriding also __init__().
This commit is contained in:
parent
5277ffe12d
commit
92bf8691fb
26 changed files with 285 additions and 67 deletions
5
Objects/clinic/enumobject.c.h
generated
5
Objects/clinic/enumobject.c.h
generated
|
@ -64,7 +64,8 @@ reversed_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
PyObject *return_value = NULL;
|
||||
PyObject *seq;
|
||||
|
||||
if ((type == &PyReversed_Type) &&
|
||||
if ((type == &PyReversed_Type ||
|
||||
type->tp_init == PyReversed_Type.tp_init) &&
|
||||
!_PyArg_NoKeywords("reversed", kwargs)) {
|
||||
goto exit;
|
||||
}
|
||||
|
@ -77,4 +78,4 @@ reversed_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=e18c3fefcf914ec7 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=a3937b6b33499560 input=a9049054013a1b77]*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue