[enhancement] Nicer error handling / more support for arguments
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
There are several possible ways to improve argument handling, but that probably doesn't have to be in this PR. Ideas:
(a, *args, b=None)is valid in Python but not pybind11.(a, /, **kwargs)allows "a=" to go into kwargs(a, / a)isn't valid in Python, but we could allow it- We could check to make sure
py::pos_only()is not at the beginning andpy::kw_only()is not at the end. - We could have a nice error if either was given twice or in the wrong order.
Originally posted by @henryiii in https://github.com/pybind/pybind11/pull/2459#discussion_r483190163
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with PR #2459 and its linked discussion, then inspect pybind11's existing argument-handling implementation for positional-only and keyword-only markers. Decide which listed Python-signature cases and ordering or duplication errors belong in scope; done requires an agreed scope and corresponding validation behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100