pybind / pybind/pybind11

[enhancement] Nicer error handling / more support for arguments

Open
#2,460 0 comments 1 reaction 0 assignees View on GitHub

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 and py::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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.