"vscode:/vscode.git/clone" did not exist on "023487164915c5b62e16a9b4e0b37cb01cd5500a"
- 24 May, 2018 1 commit
-
-
Antony Lee authored
-
- 07 May, 2018 1 commit
-
-
François Becker authored
Fixed typos (erroneous `;`) in `classes.rst`.
-
- 06 May, 2018 2 commits
-
-
luzpaz authored
Found via `codespell`
-
Tom de Geus authored
-
- 14 Apr, 2018 1 commit
-
-
oremanj authored
* Add basic support for tag-based static polymorphism Sometimes it is possible to look at a C++ object and know what its dynamic type is, even if it doesn't use C++ polymorphism, because instances of the object and its subclasses conform to some other mechanism for being self-describing; for example, perhaps there's an enumerated "tag" or "kind" member in the base class that's always set to an indication of the correct type. This might be done for performance reasons, or to permit most-derived types to be trivially copyable. One of the most widely-known examples is in LLVM: https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html This PR permits pybind11 to be informed of such conventions via a new specializable detail::polymorphic_type_hook<> template, which generalizes the previous logic for determining the runtime type of an object based on C++ RTTI. Implementors provide a way to map from a base class object to a const std::type_info* for the dynamic type; pybind11 then uses this to ensure that casting a Base* to Python creates a Python object that knows it's wrapping the appropriate sort of Derived. There are a number of restrictions with this tag-based static polymorphism support compared to pybind11's existing support for built-in C++ polymorphism: - there is no support for this-pointer adjustment, so only single inheritance is permitted - there is no way to make C++ code call new Python-provided subclasses - when binding C++ classes that redefine a method in a subclass, the .def() must be repeated in the binding for Python to know about the update But these are not much of an issue in practice in many cases, the impact on the complexity of pybind11's innards is minimal and localized, and the support for automatic downcasting improves usability a great deal.
-
- 09 Apr, 2018 1 commit
-
-
Antony Lee authored
-
- 03 Apr, 2018 1 commit
-
-
Patrik Huber authored
I think that there's the word "for" missing for that sentence to be correct. Please double-check that the sentence means what it's supposed to mean. :-)
-
- 10 Mar, 2018 1 commit
-
-
Jason Rhinelander authored
- PYBIND11_MAKE_OPAQUE now takes ... rather than a single argument and expands it with __VA_ARGS__; this lets templated, comma-containing types get through correctly. - Adds a new macro PYBIND11_TYPE() that lets you pass the type into a macro as a single argument, such as: PYBIND11_OVERLOAD(PYBIND11_TYPE(R<1,2>), PYBIND11_TYPE(C<3,4>), func) Unfortunately this only works for one macro call: to forward the argument on to the next macro call (without the processor breaking it up again) requires also adding the PYBIND11_TYPE(...) to type macro arguments in the PYBIND11_OVERLOAD_... macro chain. - updated the documentation with these two changes, and use them at a couple places in the test suite to test that they work.
-
- 28 Feb, 2018 1 commit
-
-
Tomas Babej authored
-
- 11 Jan, 2018 1 commit
-
-
luz.paz authored
Found via `codespell`
-
- 24 Nov, 2017 1 commit
-
-
Bruce Merry authored
None of the three currently recommended approaches works on PyPy, due to it not garbage collecting things when you want it to. Added a note with example showing how to get interpreter shutdown callbacks using the Python atexit module.
-
- 02 Nov, 2017 1 commit
-
-
Unknown authored
Non-user facing. Found using `codespell -q 3`
-
- 21 Sep, 2017 1 commit
-
-
Ansgar Burchardt authored
This also matches the Eigen example for the row-major case. This also enhances one of the tests to trigger a failure (and fixes it in the PR). (This isn't really a flaw in pybind itself, but rather fixes wrong code in the test code and docs).
-
- 13 Sep, 2017 1 commit
-
-
jbarlow83 authored
* Expand documentation to include explicit example of py::module::import where one would expect it. * Describe how to use unbound and bound methods to class Python classes. [skip ci]
-
- 12 Sep, 2017 1 commit
-
-
Gunnar Läthén authored
-
- 07 Sep, 2017 1 commit
-
-
Dean Moldovan authored
[skip ci]
-
- 06 Sep, 2017 1 commit
-
-
Dean Moldovan authored
-
- 04 Sep, 2017 1 commit
-
-
Patrik Huber authored
[skip ci]
-
- 01 Sep, 2017 1 commit
-
-
Bruce Merry authored
PR #880 changed the implementation of keep_alive to avoid weak references when the nurse is pybind11-registered, but the documentation didn't get updated to match.
-
- 30 Aug, 2017 1 commit
-
-
Dean Moldovan authored
This is analogous to `py::init()` vs `__init__` + placement-new. `py::pickle()` reuses most of the implementation details of `py::init()`.
-
- 28 Aug, 2017 2 commits
-
-
Wenzel Jakob authored
-
Dean Moldovan authored
[skip ci]
-
- 25 Aug, 2017 2 commits
-
-
Wenzel Jakob authored
-
Henry Schreiner authored
-
- 22 Aug, 2017 3 commits
-
-
Wenzel Jakob authored
-
Wenzel Jakob authored
-
Dean Moldovan authored
-
- 20 Aug, 2017 1 commit
-
-
Dean Moldovan authored
[skip ci]
-
- 19 Aug, 2017 2 commits
-
-
Patrik Huber authored
Fixes one small variable name typo, and two instances where `py::arg().nocopy()` is used, where I think it should be `py::arg().noconvert()` instead. Probably `nocopy()` was the old/original name for it and then it was changed.
-
Jason Rhinelander authored
The main point of `py::module_local` is to make the C++ -> Python cast unique so that returning/casting a C++ instance is well-defined. Unfortunately it also makes loading unique, but this isn't particularly desirable: when an instance contains `Type` instance there's no reason it shouldn't be possible to pass that instance to a bound function taking a `Type` parameter, even if that function is in another module. This commit solves the issue by allowing foreign module (and global) type loaders have a chance to load the value if the local module loader fails. The implementation here does this by storing a module-local loading function in a capsule in the python type, which we can then call if the local (and possibly global, if the local type is masking a global type) version doesn't work.
-
- 17 Aug, 2017 1 commit
-
-
Jason Rhinelander authored
This allows you to use: cls.def(py::init(&factory_function)); where `factory_function` returns a pointer, holder, or value of the class type (or a derived type). Various compile-time checks (static_asserts) are performed to ensure the function is valid, and various run-time type checks where necessary. Some other details of this feature: - The `py::init` name doesn't conflict with the templated no-argument `py::init<...>()`, but keeps the naming consistent: the existing templated, no-argument one wraps constructors, the no-template, function-argument one wraps factory functions. - If returning a CppClass (whether by value or pointer) when an CppAlias is required (i.e. python-side inheritance and a declared alias), a dynamic_cast to the alias is attempted (for the pointer version); if it fails, or if returned by value, an Alias(Class &&) constructor is invoked. If this constructor doesn't exist, a runtime error occurs. - for holder returns when an alias is required, we try a dynamic_cast of the wrapped pointer to the alias to see if it is already an alias instance; if it isn't, we raise an error. - `py::init(class_factory, alias_factory)` is also available that takes two factories: the first is called when an alias is not needed, the second when it is. - Reimplement factory instance clearing. The previous implementation failed under python-side multiple inheritance: *each* inherited type's factory init would clear the instance instead of only setting its own type value. The new implementation here clears just the relevant value pointer. - dealloc is updated to explicitly set the leftover value pointer to nullptr and the `holder_constructed` flag to false so that it can be used to clear preallocated value without needing to rebuild the instance internals data. - Added various tests to test out new allocation/deallocation code. - With preallocation now done lazily, init factory holders can completely avoid the extra overhead of needing an extra allocation/deallocation. - Updated documentation to make factory constructors the default advanced constructor style. - If an `__init__` is called a second time, we have two choices: we can throw away the first instance, replacing it with the second; or we can ignore the second call. The latter is slightly easier, so do that.
-
- 14 Aug, 2017 1 commit
-
-
Jason Rhinelander authored
This updates the compilation to always apply hidden visibility to resolve the issues with default visibility causing problems under debug compilations. Moreover using the cmake property makes it easier for a caller to override if absolutely needed for some reason. For `pybind11_add_module` we use cmake to set the property; for the targets, we append to compilation option to non-MSVC compilers.
-
- 12 Aug, 2017 1 commit
-
-
Dean Moldovan authored
In C++11 mode, `boost::apply_visitor` requires an explicit `result_type`. This also adds optional tests for `boost::variant` in C++11/14, if boost is available. In C++17 mode, `std::variant` is tested instead.
-
- 07 Aug, 2017 2 commits
-
-
EricCousineau-TRI authored
* Ensure :ref: for virtual_and_inheritance is parsed. * Add quick blurb about __init__ with inherited types. [skip ci]
-
Jason Rhinelander authored
boost::apply_visitor accepts its arguments by non-const lvalue reference, which fails to bind to an rvalue reference. Change the example to remove the argument forwarding.
-
- 05 Aug, 2017 1 commit
-
-
Jason Rhinelander authored
Attempting to mix py::module_local and non-module_local classes results in some unexpected/undesirable behaviour: - if a class is registered non-local by some other module, a later attempt to register it locally fails. It doesn't need to: it is perfectly acceptable for the local registration to simply override the external global registration. - going the other way (i.e. module `A` registers a type `T` locally, then `B` registers the same type `T` globally) causes a more serious issue: `A.T`'s constructors no longer work because the `self` argument gets converted to a `B.T`, which then fails to resolve. Changing the cast precedence to prefer local over global fixes this and makes it work more consistently, regardless of module load order.
-
- 04 Aug, 2017 1 commit
-
-
Jason Rhinelander authored
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).
-
- 27 Jun, 2017 2 commits
-
-
Dean Moldovan authored
-
Dean Moldovan authored
-
- 25 Jun, 2017 1 commit
-
-
Dean Moldovan authored
[skip ci]
-