- 06 May, 2018 1 commit
-
-
Tom de Geus authored
-
- 29 Apr, 2018 2 commits
-
-
Wenzel Jakob authored
-
Lori A. Burns authored
-
- 24 Apr, 2018 1 commit
-
-
David Caron 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
-
- 07 Apr, 2018 1 commit
-
-
Boris Staletic authored
The property returns the enum_ value as a string. For example: >>> import module >>> module.enum.VALUE enum.VALUE >>> str(module.enum.VALUE) 'enum.VALUE' >>> module.enum.VALUE.name 'VALUE' This is actually the equivalent of Boost.Python "name" property.
-
- 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 2 commits
-
-
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. -
Marc Schlaich authored
-
- 28 Feb, 2018 1 commit
-
-
Tomas Babej authored
-
- 07 Feb, 2018 1 commit
-
-
Wenzel Jakob 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.
-
- 17 Nov, 2017 1 commit
-
-
Wenzel Jakob authored
-
- 16 Nov, 2017 1 commit
-
-
Wenzel Jakob authored
-
- 07 Nov, 2017 1 commit
-
-
Ted Drain authored
py::class_<T>'s `def_property` and `def_property_static` can now take a `nullptr` as the getter to allow a write-only property to be established (mirroring Python's `property()` built-in when `None` is given for the getter). This also updates properties to use the new nullptr constructor internally.
-
- 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).
-
- 16 Sep, 2017 1 commit
-
-
Dean Moldovan authored
MSCV does not allow `&typeid(T)` in constexpr contexts, but the string part of the type signature can still be constexpr. In order to avoid `typeid` as long as possible, `descr` is modified to collect type information as template parameters instead of constexpr `typeid`. The actual `std::type_info` pointers are only collected in the end, as a `constexpr` (gcc/clang) or regular (MSVC) function call. Not only does it significantly reduce binary size on MSVC, gcc/clang benefit a little bit as well, since they can skip some intermediate `std::type_info*` arrays.
-
- 14 Sep, 2017 1 commit
-
-
Wenzel Jakob authored
-
- 13 Sep, 2017 2 commits
-
-
Dean Moldovan authored
-
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 2 commits
-
-
Dean Moldovan authored
E.g. trying to convert a `list` to a `std::vector<int>` without including <pybind11/stl.h> will now raise an error with a note that suggests checking the headers. The note is only appended if `std::` is found in the function signature. This should only be the case when a header is missing. E.g. when stl.h is included, the signature would contain `List[int]` instead of `std::vector<int>` while using stl_bind.h would produce something like `MyVector`. Similarly for `std::map`/`Dict`, `complex`, `std::function`/`Callable`, etc. There's a possibility for false positives, but it's pretty low.
-
Gunnar Läthén authored
-
- 10 Sep, 2017 3 commits
-
-
Dean Moldovan authored
Fixes #1075. `PyNumber_Float()` and `PyNumber_Long()` return new references.
-
Dean Moldovan authored
-
Dean Moldovan authored
To avoid an ODR violation in the test suite while testing both `stl.h` and `std_bind.h` with `std::vector<bool>`, the `py::bind_vector<std::vector<bool>>` test is moved to the secondary module (which does not include `stl.h`).
-
- 08 Sep, 2017 1 commit
-
-
Dean Moldovan authored
-
- 07 Sep, 2017 1 commit
-
-
Dean Moldovan authored
[skip ci]
-
- 06 Sep, 2017 2 commits
-
-
Dean Moldovan authored
Fixes #1061. `T` and `const T &` are compatible types.
-
Dean Moldovan authored
-
- 04 Sep, 2017 2 commits
-
-
Dean Moldovan authored
Closes #1048, closes #1052. [skip ci]
-
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.
-
- 31 Aug, 2017 4 commits
-
-
Wenzel Jakob authored
[skip ci]
-
Wenzel Jakob authored
-
Wenzel Jakob authored
-
Wenzel Jakob authored
-
- 30 Aug, 2017 1 commit
-
-
Dean Moldovan authored
[skip ci]
-