- 14 Dec, 2016 2 commits
-
-
Current g++ 7 snapshot fails to compile pybind under -std=c++17 with: ``` $ make [ 3%] Building CXX object tests/CMakeFiles/pybind11_tests.dir/pybind11_tests.cpp.o In file included from /home/jagerman/src/pybind11/tests/pybind11_tests.h:2:0, from /home/jagerman/src/pybind11/tests/pybind11_tests.cpp:10: /home/jagerman/src/pybind11/include/pybind11/pybind11.h: In instantiation of 'pybind11::cpp_function::initialize(Func&&, Return (*)(Args ...), const Extra& ...)::<lambda(pybind11::detail::function_record*, pybind11::handle, pybind11::handle, pybind11::handle)> [with Func = pybind11::cpp_function::cpp_function(Return (Class::*)(Arg ...), const Extra& ...) [with Return = int; Class = ConstructorStats; Arg = {}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling}]::<lambda(ConstructorStats*)>; Return = int; Args = {ConstructorStats*}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling}]': /home/jagerman/src/pybind11/include/pybind11/pybind11.h:120:22: required from 'struct pybind11::cpp_function::initialize(Func&&, Return (*)(Args ...), const Extra& ...) [with Func = pybind11::cpp_function::cpp_function(Return (Class::*)(Arg ...), const Extra& ...) [with Return = int; Class = ConstructorStats; Arg = {}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling}]::<lambda(ConstructorStats*)>; Return = int; Args = {ConstructorStats*}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling}]::<lambda(struct pybind11::detail::function_record*, class pybind11::handle, class pybind11::handle, class pybind11::handle)>' /home/jagerman/src/pybind11/include/pybind11/pybind11.h:120:19: required from 'void pybind11::cpp_function::initialize(Func&&, Return (*)(Args ...), const Extra& ...) [with Func = pybind11::cpp_function::cpp_function(Return (Class::*)(Arg ...), const Extra& ...) [with Return = int; Class = ConstructorStats; Arg = {}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling}]::<lambda(ConstructorStats*)>; Return = int; Args = {ConstructorStats*}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling}]' /home/jagerman/src/pybind11/include/pybind11/pybind11.h:62:9: required from 'pybind11::cpp_function::cpp_function(Return (Class::*)(Arg ...), const Extra& ...) [with Return = int; Class = ConstructorStats; Arg = {}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling}]' /home/jagerman/src/pybind11/include/pybind11/pybind11.h:984:22: required from 'pybind11::class_<type_, options>& pybind11::class_<type_, options>::def(const char*, Func&&, const Extra& ...) [with Func = int (ConstructorStats::*)(); Extra = {}; type_ = ConstructorStats; options = {}]' /home/jagerman/src/pybind11/tests/pybind11_tests.cpp:24:47: required from here /home/jagerman/src/pybind11/include/pybind11/pybind11.h:147:9: sorry, unimplemented: unexpected AST of kind cleanup_stmt }; ^ /home/jagerman/src/pybind11/include/pybind11/pybind11.h:147:9: internal compiler error: in potential_constant_expression_1, at cp/constexpr.c:5593 0x84c52a potential_constant_expression_1 ../../src/gcc/cp/constexpr.c:5593 0x84c3c0 potential_constant_expression_1 ../../src/gcc/cp/constexpr.c:5154 0x645511 finish_function(int) ../../src/gcc/cp/decl.c:15527 0x66e80b instantiate_decl(tree_node*, int, bool) ../../src/gcc/cp/pt.c:22558 0x6b61e2 instantiate_class_template_1 ../../src/gcc/cp/pt.c:10444 0x6b61e2 instantiate_class_template(tree_node*) ../../src/gcc/cp/pt.c:10514 0x75a676 complete_type(tree_node*) ../../src/gcc/cp/typeck.c:133 0x67d5a4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../src/gcc/cp/pt.c:17516 0x67ca19 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../src/gcc/cp/pt.c:16655 0x672cce tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../src/gcc/cp/pt.c:16140 0x6713dc tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../src/gcc/cp/pt.c:15408 0x671915 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../src/gcc/cp/pt.c:15394 0x671fc0 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../src/gcc/cp/pt.c:15618 0x66e97f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../src/gcc/cp/pt.c:15379 0x66e97f instantiate_decl(tree_node*, int, bool) ../../src/gcc/cp/pt.c:22536 0x6ba0cb instantiate_pending_templates(int) ../../src/gcc/cp/pt.c:22653 0x6fd7f8 c_parse_final_cleanups() ../../src/gcc/cp/decl2.c:4512 ``` which looks a lot like https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77545. The error seems to be that it gets confused about the `std::tuple<...> value` in argument_loader: it is apparently not being initialized properly. Adding a default constructor with an explicit default-initialization of `value` works around the problem.Jason Rhinelander committed -
-Wint-in-bool-context triggers many warnings when compiling eigen code, so disable it locally in eigen.h.
Jason Rhinelander committed
-
- 13 Dec, 2016 5 commits
-
-
Lori A. Burns committed
-
Lori A. Burns committed
-
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 1 commit
-
-
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
-