pybind / pybind/pybind11

Empty holder object

Open
#1,197 3 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

I have a class that is held in a smart pointer. The class is not default constructable.
In Python, I would like to instantiate the holder without an object held within, and later assign that object.

Is there a way to instantiate a holder in this manner? All my attempts to override the constructor ended up in pybind11 runtime exceptions.

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 by reproducing the reported empty-holder construction attempts in a minimal pybind11 binding, focusing on smart pointers and non-default-constructible classes. Determine whether a holder can be created without an object and assigned later; done means a supported approach is identified or the limitation is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
devtools
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.