- 13 Dec, 2016 3 commits
-
-
Lori A. Burns committed
-
Lori A. Burns committed
-
Lori A. Burns committed
-
- 12 Dec, 2016 4 commits
-
-
Dean Moldovan committed
-
Wenzel Jakob committed
-
This adds automatic casting when assigning to python types like dict, list, and attributes. Instead of: dict["key"] = py::cast(val); m.attr("foo") = py::cast(true); list.append(py::cast(42)); you can now simply write: dict["key"] = val; m.attr("foo") = true; list.append(42); Casts needing extra parameters (e.g. for a non-default rvp) still require the py::cast() call. set::add() is also supported. All usage is channeled through a SFINAE implementation which either just returns or casts. Combined non-converting handle and autocasting template methods via a helper method that either just returns (handle) or casts (C++ type).Jason Rhinelander committed -
Wenzel Jakob committed
-
- 11 Dec, 2016 1 commit
-
- 09 Dec, 2016 1 commit
-
-
Wenzel Jakob committed
-
- 08 Dec, 2016 1 commit
-
-
Dean Moldovan committed
-
- 07 Dec, 2016 2 commits
-
-
* Added ternary support with descr args Current the `_<bool>(a, b)` ternary support only works for `char[]` `a` and `b`; this commit allows it to work for `descr` `a` and `b` arguments as well. * Add support for std::valarray to stl.h This abstracts the std::array into a `array_caster` which can then be used with either std::array or std::valarray, the main difference being that std::valarray is resizable. (It also lets the array_caster be potentially used for other std::array-like interfaces, much as the list_caster and map_caster currently provide). * Small stl.h cleanups - Remove redundant `type` typedefs - make internal list_caster methods private
Jason Rhinelander committed -
Dean Moldovan committed
-
- 03 Dec, 2016 3 commits
-
-
Newer standard libraries use compiler intrinsics for std::index_sequence which makes it ‘free’. This prevents hitting instantiation limits for recursive templates (-ftemplate-depth).
Dean Moldovan committed -
This is more Pythonic and compliments the std::vector and std::list casters which also accept sequences.
Dean Moldovan committed -
This is needed in order to allow the tuple caster to accept any sequence while keeping the argument loader fast. There is also very little overlap between the two classes which makes the separation clean. It’s also good practice not to have completely new functionality in a specialization.
Dean Moldovan committed
-
- 01 Dec, 2016 2 commits
-
-
Alessandro Bacchini committed
-
esquires committed
-
- 25 Nov, 2016 3 commits
-
-
Using a complicated declval here was pointlessly complicated: we already know the type, because that's what cast_op_type<T> is in the first place. (The declval also broke MSVC).
Jason Rhinelander committed -
This adds a `detail::cast_op<T>(caster)` function which handles the rather verbose: caster.operator typename CasterType::template cast_op_type<T>() which allows various places to use the shorter and clearer: cast_op<T>(caster) instead of the full verbose cast operator invocation.Jason Rhinelander committed -
stl casters were using a value cast to (Value) or (Key), but that isn't always appropriate. This changes it to use the appropriate value converter's cast_op_type.
Jason Rhinelander committed
-
- 24 Nov, 2016 4 commits
-
-
Wenzel Jakob committed
-
C++ exceptions are destructed in the context of the code that catches them. At this point, the Python GIL may not be held, which could lead to crashes with the previous implementation. PyErr_Fetch and PyErr_Restore should always occur in pairs, which was not the case for the previous implementation. To clear the exception, the new approach uses PyErr_Restore && PyErr_Clear instead of simply decreasing the reference counts of the exception objects.
Wenzel Jakob committed -
Wenzel Jakob committed
-
Wenzel Jakob committed
-
- 22 Nov, 2016 5 commits
-
-
* Use LIBDIR and MULTIARCH on linux to find python library * Remove apple-specific setting; the non-windows one should work fine on OS X * Default LIBDIR/MULTIARCH to '' (to avoid getting None) * Remove trailing whitespace from FindPythonLibsNew
Jason Rhinelander committed -
Patrick Stewart committed
-
Previously all types are marked unaligned in buffer format strings, now we test for alignment before adding the '=' marker.
patstew committed -
Sylvain Corlay committed
-
This gives more informative output, often including the type (or at least some hint about the type).
Jason Rhinelander committed
-
- 20 Nov, 2016 6 commits
-
-
Wenzel Jakob committed
-
A flake8 configuration is included in setup.cfg and the checks are executed automatically on Travis: * Ensures a consistent PEP8 code style * Does basic linting to prevent possible bugs
Dean Moldovan committed -
Wenzel Jakob committed
-
Fixes #509. The move policy was already set for rvalues in PR #473, but this only applied to directly cast user-defined types. The problem is that STL containers cast values indirectly and the rvalue information is lost. Therefore the move policy was not set correctly. This commit fixes it. This also makes an additional adjustment to remove the `copy` policy exception: rvalues now always use the `move` policy. This is also safe for copy-only rvalues because the `move` policy has an internal fallback to copying.
Dean Moldovan committed -
Wenzel Jakob committed
-
Wenzel Jakob committed
-
- 17 Nov, 2016 5 commits
-
-
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.
Wenzel Jakob committed -
Lori A. Burns committed
-
* `array_t(const object &)` now throws on error * `array_t::ensure()` is intended for casters —- old constructor is deprecated * `array` and `array_t` get default constructors (empty array) * `array` gets a converting constructor * `py::isinstance<array_T<T>>()` checks the type (but not flags) There is only one special thing which must remain: `array_t` gets its own `type_caster` specialization which uses `ensure` instead of a simple check.
Dean Moldovan committed -
The pytype converting constructors are convenient and safe for user code, but for library internals the additional type checks and possible conversions are sometimes not desired. `reinterpret_borrow<T>()` and `reinterpret_steal<T>()` serve as the low-level unsafe counterparts of `cast<T>()`. This deprecates the `object(handle, bool)` constructor. Renamed `borrowed` parameter to `is_borrowed` to avoid shadowing warnings on MSVC.
Dean Moldovan committed -
* Deprecate the `py::object::str()` member function since `py::str(obj)` is now equivalent and preferred * Make `py::repr()` a free function * Make sure obj.cast<T>() works as expected when T is a Python type `obj.cast<T>()` should be the same as `T(obj)`, i.e. it should convert the given object to a different Python type. However, `obj.cast<T>()` usually calls `type_caster::load()` which only checks the type without doing any actual conversion. That causes a very unexpected `cast_error`. This commit makes it so that `obj.cast<T>()` and `T(obj)` are the same when T is a Python type. * Simplify pytypes converting constructor implementation It's not necessary to maintain a full set of converting constructors and assignment operators + const& and &&. A single converting const& constructor will work and there is no impact on binary size. On the other hand, the conversion functions can be significantly simplified.
Dean Moldovan committed
-