pybind / pybind/pybind11

[BUG] second pass for conversions does not handle keyword-only arguments

Open
#3,010 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
18k
Forks
2.3k
Avg merge
5d 17h
Merged PRs (30d)
10

Description

It appears that the overload resolution logic that attempts a second pass with convert=true does not properly handle keyword-only arguments:

https://github.com/pybind/pybind11/blob/f61855b9d8821e2576960109a2a67379a6c2366f/include/pybind11/pybind11.h#L780

The check there only considers positional arguments. So if you only have keyword-only arguments, a second pass is not attempted.

Is there some reason for that behavior, or should it be changed to also consider keyword arguments?

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 at include/pybind11/pybind11.h around line 780 and trace the overload-resolution second pass with convert=true. Reproduce the case involving only keyword-only arguments, then verify that the second pass is attempted and that the conversion behavior is correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.