- 06 Apr, 2019 1 commit
-
-
Henry Schreiner authored
* Fix warning that not including a cmake source or build dir will be a fatal error (it is now on newest CMakes) * Fixes appveyor * Travis uses CMake 3.9 for more than a year now * Travis dropped sudo: false in December * Dropping Sphinx 2 - clang7: Suppress self-assign warnings; fix missing virtual dtors - pypy: - Keep old version (newer stuff breaks) - Pin packages to extra index for speed - travis: - Make docker explicit; remove docker if not needed - Make commands more verbose (for debugging / repro) - Make Ubuntu dist explicit per job - Fix Windows - Add names to travis
-
- 04 Feb, 2019 3 commits
-
-
Wenzel Jakob authored
-
Guilhem Saurel authored
-
-
- 03 Jan, 2019 1 commit
-
-
Yannick Jadoul authored
-
- 01 Dec, 2018 1 commit
-
-
Borja Zarco authored
This avoids GIL deadlocking when pybind11 tries to acquire the GIL in a thread that already acquired it using standard Python API (e.g. when running from a Python thread).
-
- 16 Nov, 2018 1 commit
-
-
voxmea authored
* Adds std::deque to the types supported by list_caster in stl.h. * Adds a new test_deque test in test_stl.{py,cpp}. * Updates the documentation to include std::deque as a default supported type.
-
- 11 Nov, 2018 2 commits
-
-
Trevor Laughlin authored
* Check default holder -Recognize "std::unique_ptr<T, D>" as a default holder even if "D" doesn't match between base and derived holders * Add test for unique_ptr<T, D> change
-
Wenzel Jakob authored
Pybind11 provides a cast operator between opaque void* pointers on the C++ side and capsules on the Python side. The py::cast<void *> expression was not aware of this possibility and incorrectly triggered a compile-time assertion ("Unable to cast type to reference: value is local to type caster") that is now fixed.
-
- 09 Nov, 2018 3 commits
-
-
Wenzel Jakob authored
* Support C++17 aligned new statement This patch makes pybind11 aware of nonstandard alignment requirements in bound types and passes on this information to C++17 aligned 'new' operator. Pre-C++17, the behavior is unchanged.
-
Wenzel Jakob authored
-
Wenzel Jakob authored
This PR brings the std::array<> caster in sync with the other STL type casters: to accept an arbitrary sequence as input (rather than a list, which is too restrictive).
-
- 24 Oct, 2018 1 commit
-
-
Tarcísio Fischer authored
-
- 11 Oct, 2018 1 commit
-
-
Allan Leal authored
* Fix for Issue #1258 list_caster::load method will now check for a Python string and prevent its automatic conversion to a list. This should fix the issue "pybind11/stl.h converts string to vector<string> #1258" (https://github.com/pybind/pybind11/issues/1258) * Added tests for fix of issue #1258 * Changelog: stl string auto-conversion
-
- 02 Oct, 2018 1 commit
-
-
Jason Rhinelander authored
-
- 25 Sep, 2018 1 commit
-
-
oremanj authored
* Fix potential crash when calling an overloaded function The crash would occur if: - dispatcher() uses two-pass logic (because the target is overloaded and some arguments support conversions) - the first pass (with conversions disabled) doesn't find any matching overload - the second pass does find a matching overload, but its return value can't be converted to Python The code for formatting the error message assumed `it` still pointed to the selected overload, but during the second-pass loop `it` was nullptr. Fix by setting `it` correctly if a second-pass call returns a nullptr `handle`. Add a new test that segfaults without this fix. * Make overload iteration const-correct so we don't have to iterate again on second-pass error * Change test_error_after_conversions dependencies to local classes/variables
-
- 11 Sep, 2018 5 commits
-
-
Wenzel Jakob authored
This commit addresses an inefficiency in how enums are created in pybind11. Most of the enum_<> implementation is completely generic -- however, being a template class, it ended up instantiating vast amounts of essentially identical code in larger projects with many enums. This commit introduces a generic non-templated helper class that is compatible with any kind of enumeration. enum_ then becomes a thin wrapper around this new class. The new enum_<> API is designed to be 100% compatible with the old one.
-
Wenzel Jakob authored
object_api::operator[] has a powerful overload for py::handle that can accept slices, tuples (for NumPy), etc. Lists, sequences, and tuples provide their own specialized operator[], which unfortunately disables this functionality. This is accidental, and the purpose of this commit is to re-enable the more general behavior. This commit is tangentially related to the previous one in that it makes py::handle/py::object et al. behave more like their Python counterparts.
-
Wenzel Jakob authored
This commit revamps the object_api class so that it maps most C++ operators to their Python analogs. This makes it possible to, e.g. perform arithmetic using a py::int_ or py::array.
-
Krzysztof Fornalczyk authored
* check for already existing enum value added; added test * added enum value name to exception message * test for defining enum with multiple identical names moved to test_enum.cpp/py
-
Wenzel Jakob authored
-
- 29 Aug, 2018 2 commits
-
-
Wenzel Jakob authored
-
Justin Bassett authored
-
- 28 Aug, 2018 2 commits
-
-
Wenzel Jakob authored
-
Wenzel Jakob authored
This PR adds a new py::ellipsis() method which can be used in conjunction with NumPy's generalized slicing support. For instance, the following is now valid (where "a" is a NumPy array): py::array b = a[py::make_tuple(0, py::ellipsis(), 0)];
-
- 19 Jul, 2018 1 commit
-
-
Jason Rhinelander authored
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.
-
- 17 Jul, 2018 1 commit
-
-
Wenzel Jakob authored
* 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.
-
- 24 Jun, 2018 1 commit
-
-
Khachajantc Michael authored
-
- 18 May, 2018 1 commit
-
-
Jason Rhinelander authored
Fixes #1401
-
- 06 May, 2018 2 commits
-
-
Naotoshi Seo authored
Fix a segfault when creating a 0-dimension, c-strides array.
-
luzpaz authored
Found via `codespell`
-
- 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.
-
- 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
-
-
luz.paz authored
-
- 18 Feb, 2018 1 commit
-
-
Jason Rhinelander authored
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.
-
- 12 Jan, 2018 1 commit
-
-
Jason Rhinelander authored
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).
-
- 11 Jan, 2018 3 commits
-
-
Jason Rhinelander authored
* 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).
-
Jeff VanOss authored
Fix return from `std::map` bindings to `__delitem__`: we should be returning `void`, not an iterator. Also adds a test for map item deletion.
-
luz.paz authored
Found via `codespell`
-