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
|
@ -553,7 +553,8 @@ _io_BufferedRWPair___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||
PyObject *writer;
|
||||
Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE;
|
||||
|
||||
if (Py_IS_TYPE(self, &PyBufferedRWPair_Type) &&
|
||||
if ((Py_IS_TYPE(self, &PyBufferedRWPair_Type) ||
|
||||
Py_TYPE(self)->tp_new == PyBufferedRWPair_Type.tp_new) &&
|
||||
!_PyArg_NoKeywords("BufferedRWPair", kwargs)) {
|
||||
goto exit;
|
||||
}
|
||||
|
@ -637,4 +638,4 @@ skip_optional_pos:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=98ccf7610c0e82ba input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=79138a088729b5ee input=a9049054013a1b77]*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue