pybind / pybind/pybind11

Can't use holders around types with custom converters

Open
#787 15 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

This fails for any T with a custom type converter (e.g. std::string, Eigen::MatrixXd, MyCustomConvertingType, etc.):

m.def("f", [](std::shared_ptr<T>) {})

The issue is that the holder type casters assume that type_caster<T> is a type_caster_base<T>, and make use of type_caster_base<T> constructors and internals. #786 makes it into a compile-time failure (before that it will result in strange run-time failures as we end up invoking a generic caster on an unregistered type).

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 the holder type casters and the type_caster assumptions described in the issue, then reproduce the compile-time failure using the shared_ptr binding snippet with a custom converter. Done means holders work with custom-converted types without relying on type_caster_base internals or invoking a generic caster for an unregistered type.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.