New submission from Serhiy Storchaka <storchaka+cpyt...@gmail.com>:

In Python the function can have 4 kinds of parameters:

    def f(a, b=1, *, c, d=2):

1. a is a required positional-or-keyword parameter.
2. b is an optional positional-or-keyword parameter.
3. c is a required keyword-only parameter.
4. d is an optional keyword-only parameter.

But PyArg_ParseTupleAndKeywords() supports only 3 of them. Keyword-only 
parameters can only be optional.

    PyArg_ParseTupleAndKeywords(args, kwds, "O|O$O", kwlist, &a, &b, &d)

This makes impossible using PyArg_ParseTupleAndKeywords() for haslib.scrypt(). 
Currently it parses all keyword-only arguments as optional, and checks that 
they are specified specially, but this does not allow to use the full power of 
the PyArg_Parse* API.

----------
assignee: serhiy.storchaka
components: Interpreter Core
messages: 322419
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: PyArg_ParseTupleAndKeywords: support required keyword arguments
type: enhancement
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34235>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to