Skip to content

Commit cae4ae0

Browse files
authored
docs: clarify to what extent bindings are actually global (#5859)
1 parent 3262000 commit cae4ae0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

docs/advanced/classes.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -972,9 +972,14 @@ Module-local class bindings
972972
===========================
973973

974974
When creating a binding for a class, pybind11 by default makes that binding
975-
"global" across modules. What this means is that a type defined in one module
976-
can be returned from any module resulting in the same Python type. For
977-
example, this allows the following:
975+
"global" across modules. What this means is that instances whose type is
976+
defined with a ``py::class_`` statement in one module can be passed to or
977+
returned from a function defined in any other module that is "ABI compatible"
978+
with the first, i.e., that was built with sufficiently similar versions of
979+
pybind11 and of the C++ compiler and C++ standard library. The internal data
980+
structures that pybind11 uses to keep track of its types and instances are
981+
shared just as they would be if everything were in the same module.
982+
For example, this allows the following:
978983

979984
.. code-block:: cpp
980985

0 commit comments

Comments
 (0)