pybind / pybind/pybind11

Building python modules with static runtime

Open
#1,618 2 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

Am I correct that if I use pybind11 to build python modules (pyd shared libraries on windows) with static runtime things can go horribly bad?
Details

It is not as obvious from docs, but while looking at the code I've figured out that: there is this shared internals object (see get_internals()). Which contains a lot of std containers. If my application would have say 2 pybind11 modules it could happen that allocation/deallocation will happen across dll boundaries? Moreover static runtimes can be different. Not to mention potential ABI incompatibility.

Follow up question

If I make every pybind11 module with own internals (by having unique PYBIND11_INTERNALS_ID) what would the downsides be? What features will be lost?

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 get_internals() implementation and the existing documentation around static runtimes and PYBIND11_INTERNALS_ID. Determine the cross-module allocation and ABI risks, then document the consequences and lost features of giving each module separate internals.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
backend-api-design, build-system
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.