- 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 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 5 commits
-
-
Dean Moldovan authored
[skip ci]
-
Ivan Smirnov authored
-
Bruce Merry authored
There are two separate additions: 1. `py::hash(obj)` is equivalent to the Python `hash(obj)`. 2. `.def(hash(py::self))` registers the hash function defined by `std::hash<T>` as the Python hash function.
-
Dean Moldovan authored
The warning is shown at module initialization time (on import, not when the functions are called). It's only visible when compiled in debug mode.
-
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 3 commits
-
-
Wenzel Jakob authored
-
Wenzel Jakob authored
-
Dean Moldovan authored
[skip ci]
-
- 25 Aug, 2017 2 commits
-
-
Wenzel Jakob authored
-
Henry Schreiner authored
-
- 23 Aug, 2017 2 commits
-
-
Matthias Hochsteger authored
-
Wenzel Jakob authored
-
- 22 Aug, 2017 3 commits
-
-
Wenzel Jakob authored
-
Wenzel Jakob authored
-
Dean Moldovan authored
-
- 20 Aug, 2017 2 commits
-
-
Dean Moldovan authored
[skip ci]
-
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 2 commits
-
-
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. -
Dean Moldovan authored
* Doxygen needs `RECURSIVE = YES` in order to parse the `detail` subdir. * The `-W` warnings-as-errors option for sphinx doesn't work with the makefile build. Switched to calling sphinx directly. * Fix "citation [cppimport] is not referenced" warning.
-
- 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.
-