pybind11/docs
Jason Rhinelander 7437c69500 Add py::module_local() attribute for module-local type bindings
This commit adds a `py::module_local` attribute that lets you confine a
registered type to the module (more technically, the shared object) in
which it is defined, by registering it with:

    py::class_<C>(m, "C", py::module_local())

This will allow the same C++ class `C` to be registered in different
modules with independent sets of class definitions.  On the Python side,
two such types will be completely distinct; on the C++ side, the C++
type resolves to a different Python type in each module.

This applies `py::module_local` automatically to `stl_bind.h` bindings
when the container value type looks like something global: i.e. when it
is a converting type (for example, when binding a `std::vector<int>`),
or when it is a registered type itself bound with `py::module_local`.
This should help resolve potential future conflicts (e.g. if two
completely unrelated modules both try to bind a `std::vector<int>`.
Users can override the automatic selection by adding a
`py::module_local()` or `py::module_local(false)`.

Note that this does mildly break backwards compatibility: bound stl
containers of basic types like `std::vector<int>` cannot be bound in one
module and returned in a different module.  (This can be re-enabled with
`py::module_local(false)` as described above, but with the potential for
eventual load conflicts).
2017-08-04 10:47:34 -04:00
..
_static documentation improvements 2016-04-26 23:48:55 +02:00
advanced Add py::module_local() attribute for module-local type bindings 2017-08-04 10:47:34 -04:00
basics.rst Update basics.rst 2017-06-08 16:42:44 -03:00
benchmark.py Replace PYBIND11_PLUGIN with PYBIND11_MODULE 2017-05-29 03:21:19 +02:00
benchmark.rst Replace PYBIND11_PLUGIN with PYBIND11_MODULE 2017-05-29 03:21:19 +02:00
changelog.rst changelog for v2.1.1 2017-04-07 02:08:29 +02:00
classes.rst Document automatic upcasting of polymorphic types (#654) 2017-07-23 03:36:08 +02:00
compiling.rst Fix CMake example code in embedding docs 2017-05-31 13:49:27 +02:00
conf.py updated version information for v2.2 development 2017-03-22 22:20:07 +01:00
Doxyfile Automate generation of reference docs with doxygen and breathe (#598) 2017-01-31 16:54:08 +01:00
faq.rst Replace PYBIND11_PLUGIN with PYBIND11_MODULE 2017-05-29 03:21:19 +02:00
index.rst Add tutorial page for embedding the interpreter 2017-05-28 02:12:24 +02:00
intro.rst Make non-ancient version of GCC explicit in documentation (it means 4.8+) (#575) 2016-12-28 12:10:11 +01:00
limitations.rst Multiple inheritance support 2016-09-19 13:45:31 +02:00
Makefile took a stab at some documentation 2015-10-13 03:16:44 +02:00
pybind11_vs_boost_python1.png documentation improvements 2016-04-28 15:32:07 +02:00
pybind11_vs_boost_python1.svg Much more efficient generation of function signatures, updated docs 2016-01-17 22:31:15 +01:00
pybind11_vs_boost_python2.png documentation improvements 2016-04-28 15:32:07 +02:00
pybind11_vs_boost_python2.svg Much more efficient generation of function signatures, updated docs 2016-01-17 22:31:15 +01:00
pybind11-logo.png Very minor documentation fixes, updated logo 2016-01-17 22:31:15 +01:00
reference.rst Replace PYBIND11_PLUGIN with PYBIND11_MODULE 2017-05-29 03:21:19 +02:00
release.rst minor setup.py updates 2017-01-01 17:14:27 +01:00
requirements.txt Fix readthedocs build (#721) 2017-03-12 22:36:48 +01:00