diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2021-09-12 10:27:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-12 10:27:50 (GMT) |
commit | 92bf8691fb78f3484bf2daba836c416efedb1d8d (patch) | |
tree | f5e605dbb607ec58daa687300a5f59f99dd1aee4 /Modules/clinic/_queuemodule.c.h | |
parent | 5277ffe12d492939544ff9c54a3aaf448b913fb3 (diff) | |
download | cpython-92bf8691fb78f3484bf2daba836c416efedb1d8d.zip cpython-92bf8691fb78f3484bf2daba836c416efedb1d8d.tar.gz cpython-92bf8691fb78f3484bf2daba836c416efedb1d8d.tar.bz2 |
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__().
Diffstat (limited to 'Modules/clinic/_queuemodule.c.h')
-rw-r--r-- | Modules/clinic/_queuemodule.c.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/clinic/_queuemodule.c.h b/Modules/clinic/_queuemodule.c.h index 8741f7d..d952256 100644 --- a/Modules/clinic/_queuemodule.c.h +++ b/Modules/clinic/_queuemodule.c.h @@ -16,11 +16,13 @@ simplequeue_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - if ((type == simplequeue_get_state_by_type(type)->SimpleQueueType) && + if ((type == simplequeue_get_state_by_type(type)->SimpleQueueType || + type->tp_init == simplequeue_get_state_by_type(type)->SimpleQueueType->tp_init) && !_PyArg_NoPositional("SimpleQueue", args)) { goto exit; } - if ((type == simplequeue_get_state_by_type(type)->SimpleQueueType) && + if ((type == simplequeue_get_state_by_type(type)->SimpleQueueType || + type->tp_init == simplequeue_get_state_by_type(type)->SimpleQueueType->tp_init) && !_PyArg_NoKeywords("SimpleQueue", kwargs)) { goto exit; } @@ -246,4 +248,4 @@ _queue_SimpleQueue_qsize(simplequeueobject *self, PyObject *Py_UNUSED(ignored)) exit: return return_value; } -/*[clinic end generated code: output=ce56b46fac150909 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=96cc57168d72aab1 input=a9049054013a1b77]*/ |