- 11 Sep, 2018 19 commits
-
-
Wenzel Jakob committed
-
Catch v2 changed the `run(...)` signature to take a `char *argv[]`, arguing partly that technically a `char *argv[]` type is the correct `main()` signature rather than `const char *argv[]`. Dropping the `const` here doesn't appear to cause any problems with catch v1 (tested against both the cmake-downloaded 1.9.3 and Debian's 1.12.1 package) so we can follow suit.
Jason Rhinelander committed -
* stl.h: propagate return value policies to type-specific casters Return value policies for containers like those handled in in 'stl.h' are currently broken. The problem is that detail::return_value_policy_override<C>::policy() always returns 'move' when given a non-pointer/reference type, e.g. 'std::vector<...>'. This is sensible behavior for custom types that are exposed via 'py::class_<>', but it does not make sense for types that are handled by other type casters (STL containers, Eigen matrices, etc.). This commit changes the behavior so that detail::return_value_policy_override only becomes active when the type caster derives from type_caster_generic. Furthermore, the override logic is called recursively in STL type casters to enable key/value-specific behavior.
Wenzel Jakob committed -
Wenzel Jakob committed
-
Switching deprecated Thread Local Storage (TLS) usage in Python 3.7 to Thread Specific Storage (TSS) (#1454) * Switching deprecated Thread Local Storage (TLS) usage in Python 3.7 to Thread Specific Storage (TSS) * Changing Python version from 3.6 to 3.7 for Travis CI, to match brew's version of Python 3 * Introducing PYBIND11_ macros to switch between TLS and TSS API
Yannick Jadoul committed -
Boris Dalstein committed
-
Thomas Hrabe committed
-
* Silence GCC8's -Wcast-function-type. See https://bugs.python.org/issue33012 and PRs linked therein.
Antony Lee committed -
It is useful not only to remember the python libs and includes but also the interpreter version in cache. If users call pybind11 throught `add_subdirectories` they will otherwise have no access to the selected interpreter version. The interpreter version is useful for downstream projects, e.g. to select default `lib/pythonX.Y/site-packages/` install paths.
Axel Huebl committed -
Khachajantc Michael committed
-
Maciek Starzyk committed
-
Add missing python3 distutils on Debian "buster".
Axel Huebl committed -
If an exception is thrown during module initialization, the error_already_set destructor will try to call `get_internals()` *after* setting Python's error indicator, resulting in a `SystemError: ... returned with an error set`. Fix that by temporarily stashing away the error indicator in the destructor.
Antony Lee committed -
Antony Lee committed
-
David Caron committed
-
Found via `codespell`
luzpaz committed -
Fixes #1401
Jason Rhinelander committed -
Fix a segfault when creating a 0-dimension, c-strides array.
Naotoshi Seo committed -
Lori A. Burns committed
-
- 29 Apr, 2018 7 commits
-
-
Wenzel Jakob committed
-
Henry Schreiner committed
-
Wenzel Jakob committed
-
Lori A. Burns committed
-
As reported in #1349, clang before 3.5 can segfault on a function-local variable referenced inside a lambda. This moves the function-local static into a separate function that the lambda can invoke to avoid the issue. Fixes #1349
Jason Rhinelander committed -
This fixes the test code on big-endian architectures: the array support (PR #832) had hard-coded the little-endian '<' but we need to use '>' on big-endian architectures.
Jason Rhinelander committed -
Wenzel Jakob committed
-
- 07 Feb, 2018 14 commits
-
-
Wenzel Jakob committed
-
Jason Rhinelander committed
-
Wenzel Jakob committed
-
Current MSVC generates totally bizarre errors: error C2884: 'pybind11::detail::_': introduced by using-declaration conflicts with local function 'pybind11::detail::_' which makes no sense (since the supposed "conflict" is the function itself). Work around it by `using namespace detail;` instead (which also lets us drop a bunch of other `detail::` qualifications, so isn't actually a bad thing).Jason Rhinelander committed -
This updates the `py::init` constructors to only use brace initialization for aggregate initiailization if there is no constructor with the given arguments. This, in particular, fixes the regression in #1247 where the presence of a `std::initializer_list<T>` constructor started being invoked for constructor invocations in 2.2 even when there was a specific constructor of the desired type. The added test case demonstrates: without this change, it fails to compile because the `.def(py::init<std::vector<int>>())` constructor tries to invoke the `T(std::initializer_list<std::vector<int>>)` constructor rather than the `T(std::vector<int>)` constructor. By only using `new T{...}`-style construction when a `T(...)` constructor doesn't exist, we should bypass this by while still allowing `py::init<...>` to be used for aggregate type initialization (since such types, by definition, don't have a user-declared constructor).Jason Rhinelander committed -
This fixes #1251 (patient vector grows without bounds) for the 2.2.2 branch by checking that the vector doesn't already have the given patient. This is a little less elegant than the same fix for `master` (which changes the patients `vector` to an `unordered_set`), but that requires an internals layout change, which this approach avoids.
Jason Rhinelander committed -
* Fix segfault when reloading interpreter with external modules When embedding the interpreter and loading external modules in that embedded interpreter, the external module correctly shares its internals_ptr with the one in the embedded interpreter. When the interpreter is shut down, however, only the `internals_ptr` local to the embedded code is actually reset to nullptr: the external module remains set. The result is that loading an external pybind11 module, letting the interpreter go through a finalize/initialize, then attempting to use something in the external module fails because this external module is still trying to use the old (destroyed) internals. This causes undefined behaviour (typically a segfault). This commit fixes it by adding a level of indirection in the internals path, converting the local internals variable to `internals **` instead of `internals *`. With this change, we can detect a stale internals pointer and reload the internals pointer (either from a capsule or by creating a new internals instance). (No issue number: this was reported on gitter by @henryiii and @aoloe).
Jason Rhinelander committed -
Fix return from `std::map` bindings to `__delitem__`: we should be returning `void`, not an iterator. Also adds a test for map item deletion.
Jeff VanOss committed -
Found via `codespell`
luz.paz committed -
The anonymous struct nested in a union triggers a -Wnested-anon-type warning ("anonymous types declared in an anonymous union are an extension") under clang (#1204). This names the struct and defines it out of the definition of `instance` to get around to warning (and makes the code slightly simpler).Jason Rhinelander committed -
- UPDATEIFCOPY is deprecated, replaced with similar (but not identical) WRITEBACKIFCOPY; trying to access the flag causes a deprecation warning under numpy 1.14, so just check the new flag there. - Numpy `repr` formatting of floats changed in 1.14.0 to `[1., 2., 3.]` instead of the pre-1.14 `[ 1., 2., 3.]`. Updated the tests to check for equality with the `repr(...)` value rather than the hard-coded (and now version-dependent) string representation.
Jason Rhinelander committed -
Jason Rhinelander committed
-
Jason Rhinelander committed
-
When using the mixed position + vararg path, pybind over inc_ref's the vararg positions. Printing the ref_count() of `item` before and after this change you see: Before change: ``` refcount of item before assign 3 refcount of item after assign 5 ``` After change ``` refcount of item before assign 3 refcount of item after assign 4 ```
Zach DeVito committed
-