- 30 Sep, 2021 1 commit
-
-
xaedes authored
* Docs: Demonstrate non-enum internal types in example Previously example only demonstrated internal enumeration type. To show that it works for other internal types the same way the example was updated with an additional struct Pet::Attributes type. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by:
pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
-
- 22 Sep, 2021 1 commit
-
-
Aaron Gokaslan authored
* Apply blacken-docs and fix language-hints * Add blacken-docs pre-commit hook * Add pycln pre-commit hook * Enable a few builtin hooks * Black no longer ignores pyi files
-
- 14 Sep, 2020 1 commit
-
-
Boris Staletic authored
Why only for pointers? Because C casts are hard to grep for.
-
- 18 Aug, 2020 1 commit
-
-
Mosalam Ebrahimi authored
-
- 19 Aug, 2019 1 commit
-
-
Andre Schmeißer authored
* Make `overload_cast_impl` available in C++11 mode. Narrow the scope of the `#if defined(PYBIND11_CPP14)` block around overload_cast to only cover the parts where C++14 is stricly required. Thus, the implementation in `pybind11::details::overload_cast_impl` is still available in C++11 mode. * PR #1581: Modify test to use overload_cast_impl, update docs and change log
-
- 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.
-
- 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.
-
- 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.
-
- 23 Jul, 2017 1 commit
-
-
Dustin Spicuzza authored
Resolves #645.
-
- 29 May, 2017 1 commit
-
-
Dean Moldovan authored
This commit also adds `doc()` to `object_api` as a shortcut for the `attr("__doc__")` accessor. The module macro changes from: ```c++ PYBIND11_PLUGIN(example) { pybind11::module m("example", "pybind11 example plugin"); m.def("add", [](int a, int b) { return a + b; }); return m.ptr(); } ``` to: ```c++ PYBIND11_MODULE(example, m) { m.doc() = "pybind11 example plugin"; m.def("add", [](int a, int b) { return a + b; }); } ``` Using the old macro results in a deprecation warning. The warning actually points to the `pybind11_init` function (since attributes don't bind to macros), but the message should be quite clear: "PYBIND11_PLUGIN is deprecated, use PYBIND11_MODULE".
-
- 03 Mar, 2017 1 commit
-
-
Matthieu Bec authored
-
- 31 Jan, 2017 1 commit
-
-
Dean Moldovan authored
* Make 'any' the default markup role for Sphinx docs * Automate generation of reference docs with doxygen and breathe * Improve reference docs coverage
-
- 13 Jan, 2017 1 commit
-
-
myd7349 authored
* [Doc] Fix several errors of examples from the doc * Add missing operator def. * Added missing `()` * Add missing `namespace`.
-
- 08 Dec, 2016 1 commit
-
-
Dean Moldovan authored
-
- 17 Nov, 2016 1 commit
-
-
Wenzel Jakob authored
Following commit 90d278, the object code generated by the python bindings of nanogui (github.com/wjakob/nanogui) went up by a whopping 12%. It turns out that that project has quite a few enums where we don't really care about arithmetic operators. This commit thus partially reverts the effects of #503 by introducing an additional attribute py::arithmetic() that must be specified if the arithmetic operators are desired.
-
- 13 Oct, 2016 1 commit
-
-
Dean Moldovan authored
-
- 19 Sep, 2016 1 commit
-
-
Wenzel Jakob authored
-
- 07 Sep, 2016 1 commit
-
-
Jason Rhinelander authored
This allows a slightly cleaner base type specification of: py::class_<Type, Base>("Type") as an alternative to py::class_<Type>("Type", py::base<Base>()) As with the other template parameters, the order relative to the holder or trampoline types doesn't matter. This also includes a compile-time assertion failure if attempting to specify more than one base class (but is easily extendible to support multiple inheritance, someday, by updating the class_selector::set_bases function to set multiple bases).
-
- 22 Jun, 2016 1 commit
-
-
Wenzel Jakob authored
-
- 03 Jun, 2016 1 commit
-
-
Wenzel Jakob authored
-
- 07 Feb, 2016 1 commit
-
-
Wenzel Jakob authored
-
- 17 Jan, 2016 3 commits
-
-
Wenzel Jakob authored
- new pybind11::base<> attribute to indicate a subclass relationship - unified infrastructure for parsing variadic arguments in class_ and cpp_function - use 'handle' and 'object' more consistently everywhere
-
Wenzel Jakob authored
-
Wenzel Jakob authored
-
- 19 Oct, 2015 1 commit
-
-
Wenzel Jakob authored
-
- 18 Oct, 2015 1 commit
-
-
Wenzel Jakob authored
-
- 15 Oct, 2015 2 commits
-
-
Wenzel Jakob authored
-
Wenzel Jakob authored
-
- 13 Oct, 2015 2 commits
-
-
Wenzel Jakob authored
-
Wenzel Jakob authored
-