"vscode:/vscode.git/clone" did not exist on "eb0f1cc7bfdb957d9e60f93ea91af9d56e3351a7"
- 10 Jun, 2017 1 commit
-
-
Dean Moldovan authored
Fixes #896. From Python docs: "Once an iterator’s `__next__()` method raises `StopIteration`, it must continue to do so on subsequent calls. Implementations that do not obey this property are deemed broken."
-
- 07 Jun, 2017 1 commit
-
-
Dean Moldovan authored
Fixes #887.
-
- 28 May, 2017 1 commit
-
-
Dean Moldovan authored
-
- 25 May, 2017 2 commits
-
-
Jason Rhinelander authored
Adds `remove_reference_t` and converts various `typename std::remove_reference<...>::type` to using it.
-
Jason Rhinelander authored
This allows calling of functions (typically void) over a parameter pack, replacing usage such as: bool unused[] = { (voidfunc(param_pack_arg), false)..., false }; (void) unused; with a much cleaner: PYBIND11_EXPAND_SIDE_EFFECTS(voidfunc(param_pack_arg));
-
- 24 May, 2017 2 commits
-
-
Jason Rhinelander authored
This attribute lets you disable (or explicitly enable) passing None to an argument that otherwise would allow it by accepting a value by raw pointer or shared_ptr.
-
Jason Rhinelander authored
This commit allows type_casters to allow their local values to be moved away, rather than copied, when the type caster instance itself is an rvalue. This only applies (automatically) to type casters using PYBIND11_TYPE_CASTER; the generic type type casters don't own their own pointer, and various value casters (e.g. std::string, std::pair, arithmetic types) already cast to an rvalue (i.e. they return by value). This updates various calling code to attempt to get a movable value whenever the value is itself coming from a type caster about to be destroyed: for example, when constructing an std::pair or various stl.h containers. For types that don't support value moving, the cast_op falls back to an lvalue cast. There wasn't an obvious place to add the tests, so I added them to test_copy_move_policies, but also renamed it to drop the _policies as it now tests more than just policies.
-
- 22 May, 2017 3 commits
-
-
Bruce Merry authored
Closes #857, by adding overloads to def_buffer that match pointers to member functions and wrap them in lambdas.
-
Jason Rhinelander authored
This changes javadoc-style documenting comments from: /** Text starts here * and continues here */ to: /** * Test starts here * and continues here */ which looks a little better, and also matches the javadoc-recommended way of writing documenting comments. -
Jason Rhinelander authored
Using a dynamic_cast instead of a static_cast is needed to safely cast from a base to a derived type. The previous static_pointer_cast isn't safe, however, when downcasting (and fails to compile when downcasting with virtual inheritance). Switching this to always use a dynamic_pointer_cast shouldn't incur any additional overhead when a static_pointer_cast is safe (i.e. when upcasting, or self-casting): compilers don't need RTTI checks in those cases.
-
- 09 May, 2017 3 commits
-
-
Jason Rhinelander authored
The PYBIND11_CPP14 macro started out as a guard for the compile-time path code in `descr.h`, but has since come to mean other things. This means that while the `descr.h` check has just checked the `PYBIND11_CPP14` macro, various other places now check `PYBIND11_CPP14 || _MSC_VER`. This reverses that by now setting the CPP14 macro when MSVC is trying to support C++14, but disabling the `descr.h` C++14 code (which still fails under MSVC 2017). The CPP17 macro also gets enabled when MSVC 2017 is compiling with /std:c++latest (the default is /std:c++14), which enables `std::optional` and `std::variant` support under MSVC.
-
Jason Rhinelander authored
-
Jason Rhinelander authored
GCC 7 generates (when compiling in C++11/14 mode) warnings such as: mangled name for ‘pybind11::class_<type_, options>& pybind11::class_<type_, options>::def(const char*, Func&&, const Extra& ...) [with Func = int (test_exc_sp::C::*)(int) noexcept; Extra = {}; type_ = test_exc_sp::C; options = {}]’ will change in C++17 because the exception specification is part of a function type [-Wnoexcept-type] There's nothing we can actually do in the code to avoid this, so just disable the warning.
-
- 07 May, 2017 1 commit
-
-
Dean Moldovan authored
-
- 29 Apr, 2017 1 commit
-
-
Wenzel Jakob authored
Enumerations on Python 2.7 were not always implicitly converted to integers (depending on the target size). This patch adds a __long__ conversion function (only enabled on 2.7) which fixes this issue. The attached test case fails without this patch.
-
- 28 Apr, 2017 1 commit
-
-
Jason Rhinelander authored
Python 3's `PyInstanceMethod_Type` hides itself via its `tp_descr_get`, which prevents aliasing methods via `cls.attr("m2") = cls.attr("m1")`: instead the `tp_descr_get` returns a plain function, when called on a class, or a `PyMethod`, when called on an instance. Override that behaviour for pybind11 types with a special bypass for `PyInstanceMethod_Types`.
-
- 27 Apr, 2017 1 commit
-
-
Jason Rhinelander authored
This commits adds base class pointers of offset base classes (i.e. due to multiple inheritance) to `registered_instances` so that if such a pointer is returned we properly recognize it as an existing instance. Without this, returning a base class pointer will cast to the existing instance if the pointer happens to coincide with the instance pointer, but constructs a new instance (quite possibly with a segfault, if ownership is applied) for unequal base class pointers due to multiple inheritance.
-
- 18 Apr, 2017 1 commit
-
-
Jason Rhinelander authored
We currently fail at runtime when trying to call a method that is overloaded with both static and non-static methods. This is something python won't allow: the object is either a function or an instance, and can't be both.
-
- 02 Apr, 2017 2 commits
-
-
Dean Moldovan authored
-
Dean Moldovan authored
```c++ m.def("foo", foo, py::call_guard<T>()); ``` is equivalent to: ```c++ m.def("foo", [](args...) { T scope_guard; return foo(args...); // forwarded arguments }); ```
-
- 30 Mar, 2017 1 commit
-
-
Wenzel Jakob authored
-
- 22 Mar, 2017 2 commits
-
-
Wenzel Jakob authored
* nicer py::capsule destructor mechanism * added destructor-only version of capsule & tests * added documentation for module destructors (fixes #733)
-
Dean Moldovan authored
Fixes #754.
-
- 19 Mar, 2017 1 commit
-
-
Jason Rhinelander authored
py::arg() doesn't only specify named arguments anymore, so the error message was misleading (e.g. when using `py::arg().noconvert()` and forgetting `py::arg()` for a second positional argument).
-
- 18 Mar, 2017 1 commit
-
-
Jason Rhinelander authored
This adds brief API documentation for make_iterator/make_key_iterator, specifically mentioning that it requires InputIterators. Closes #734. [skip ci] (no code change here)
-
- 17 Mar, 2017 1 commit
-
-
Jason Rhinelander authored
We can't support this for classes from imported modules (which is the primary purpose of a ctor argument base class) because we *have* to have both parent and derived to properly extract a multiple-inheritance base class pointer from a derived class pointer. We could support this for actual `class_<Base, ...> instances, but since in that case the `Base` is already present in the code, it seems more consistent to simply always require MI to go via template options.
-
- 13 Mar, 2017 1 commit
-
-
Jason Rhinelander authored
Fixes #697
-
- 12 Mar, 2017 1 commit
-
-
Jason Rhinelander authored
The `decltype(...)` in the template parameter that gives us SFINAE matching for a lambda makes MSVC 2017 ICE; this works around if by changing the test to an explicit not-a-function-or-pointer test, which seems to work everywhere.
-
- 08 Mar, 2017 1 commit
-
-
Jason Rhinelander authored
When using pybind::options to disable function signatures, user-defined docstrings only get appended if they exist, but newlines were getting appended unconditionally, so the docstring could end up with blank lines (depending on which overloads, in particular, provided docstrings). This commit suppresses the empty lines by only adding newlines for overloads when needed.
-
- 04 Mar, 2017 1 commit
-
-
Jason Rhinelander authored
Added in 6fb48490 The second constructor can't be doing anything--the signatures are exactly the same, and so the first is always going to be the one invoked by the dispatcher.
-
- 03 Mar, 2017 1 commit
-
-
Matthieu Bec authored
-
- 26 Feb, 2017 1 commit
-
-
Dean Moldovan authored
* The definition of `PySequence_Fast` is more restrictive on PyPy, so use the slow path instead. * `PyDict_Next` has been fixed in PyPy -> remove workaround.
-
- 24 Feb, 2017 3 commits
-
-
Jason Rhinelander authored
Eigen::Ref objects, when returned, are almost always returned as rvalues; what's important is the data they reference, not the outer shell, and so we want to be able to use `::copy`, `::reference_internal`, etc. to refer to the data the Eigen::Ref references (in the following commits), rather than the Eigen::Ref instance itself. This moves the policy override into a struct so that code that wants to avoid it (or wants to provide some other Return-type-conditional override) can create a specialization of return_value_policy_override<Return> in order to override the override. This lets an Eigen::Ref-returning function be bound with `rvp::copy`, for example, to specify that the data should be copied into a new numpy array rather than referenced, or `rvp::reference_internal` to indicate that it should be referenced, but a keep-alive used (actually, we used the array's `base` rather than a py::keep_alive in such a case, but it accomplishes the same thing).
-
Jason Rhinelander authored
With the previous commit, output can be very confusing because you only see positional arguments in the "invoked with" line, but you can have a failure from kwargs as well (in particular, when a value is invalidly specified via both via positional and kwargs). This commits adds kwargs to the output, and updates the associated tests to match.
-
Jason Rhinelander authored
Fixes #688. My (commented) assumption that such an error is "highly likely to be a caller mistake" was proven false by #688.
-
- 23 Feb, 2017 3 commits
-
-
Dean Moldovan authored
Now that only one shared metaclass is ever allocated, it's extremely cheap to enable it for all pybind11 types. * Deprecate the default py::metaclass() since it's not needed anymore. * Allow users to specify a custom metaclass via py::metaclass(handle).
-
Dean Moldovan authored
In order to fully satisfy Python's inheritance type layout requirements, all types should have a common 'solid' base. A solid base is one which has the same instance size as the derived type (not counting the space required for the optional `dict_ptr` and `weakrefs_ptr`). Thus, `object` does not qualify as a solid base for pybind11 types and this can lead to issues with multiple inheritance. To get around this, new base types are created: one per unique instance size. There is going to be very few of these bases. They ensure Python's MRO checks will pass when multiple bases are involved.
-
Dean Moldovan authored
Instead of creating a new unique metaclass for each type, the builtin `property` type is subclassed to support static properties. The new setter/getters always pass types instead of instances in their `self` argument. A metaclass is still required to support this behavior, but it doesn't store any data anymore, so a new one doesn't need to be created for each class. There is now only one common metaclass which is shared by all pybind11 types.
-
- 17 Feb, 2017 1 commit
-
-
Jason Rhinelander authored
noexcept deduction, added in PR #555, doesn't work with clang's -std=c++1z; and while it works with g++, it isn't entirely clear to me that it is required to work in C++17. What should work, however, is that C++17 allows implicit conversion of a `noexcept(true)` function pointer to a `noexcept(false)` (i.e. default, noexcept-not-specified) function pointer. That was breaking in pybind11 because the cpp_function template used for lambdas provided a better match (i.e. without requiring an implicit conversion), but it then failed. This commit takes a different approach of using SFINAE on the lambda function to prevent it from matching a non-lambda object, which then gets implicit conversion from a `noexcept` function pointer to a `noexcept(false)` function pointer. This much nicer solution also gets rid of the C++17 NOEXCEPT macros, and works in both clang and g++.
-
- 08 Feb, 2017 1 commit
-
-
Matthew Woehlke authored
* Avoid C-style const casts Replace C-style casts that discard `const` with `const_cast` (and, where necessary, `reinterpret_cast` as well). * Warn about C-style const-discarding casts Change pybind11_enable_warnings to also enable `-Wcast-qual` (warn if a C-style cast discards `const`) by default. The previous commit should have gotten rid of all of these (at least, all the ones that tripped in my build, which included the tests), and this should discourage more from newly appearing.
-