1. 04 Jan, 2017 8 commits
  2. 01 Jan, 2017 1 commit
  3. 29 Dec, 2016 2 commits
  4. 28 Dec, 2016 1 commit
  5. 26 Dec, 2016 7 commits
  6. 23 Dec, 2016 2 commits
  7. 19 Dec, 2016 5 commits
  8. 18 Dec, 2016 1 commit
  9. 16 Dec, 2016 1 commit
    • WIP: PyPy support (#527) · 1d1f81b2
      This commit includes modifications that are needed to get pybind11 to work with PyPy. The full test suite compiles and runs except for a last few functions that are commented out (due to problems in PyPy that were reported on the PyPy bugtracker).
      
      Two somewhat intrusive changes were needed to make it possible: two new tags ``py::buffer_protocol()`` and ``py::metaclass()`` must now be specified to the ``class_`` constructor if the class uses the buffer protocol and/or requires a metaclass (e.g. for static properties).
      
      Note that this is only for the PyPy version based on Python 2.7 for now. When the PyPy 3.x has caught up in terms of cpyext compliance, a PyPy 3.x patch will follow.
      Wenzel Jakob committed
  10. 15 Dec, 2016 3 commits
  11. 14 Dec, 2016 9 commits
    • Change all_of_t/any_of_t to all_of/any_of, add none_of · fa5d05e1
      This replaces the current `all_of_t<Pred, Ts...>` with `all_of<Ts...>`,
      with previous use of `all_of_t<Pred, Ts...>` becoming
      `all_of<Pred<Ts>...>` (and similarly for `any_of_t`).  It also adds a
      `none_of<Ts...>`, a shortcut for `negation<any_of<Ts...>>`.
      
      This allows `all_of` and `any_of` to be used a bit more flexible, e.g.
      in cases where several predicates need to be tested for the same type
      instead of the same predicate for multiple types.
      
      This commit replaces the implementation with a more efficient version
      for non-MSVC.  For MSVC, this changes the workaround to use the
      built-in, recursive std::conjunction/std::disjunction instead.
      
      This also removes the `count_t` since `any_of_t` and `all_of_t` were the
      only things using it.
      
      This commit also rearranges some of the future std imports to use actual
      `std` implementations for C++14/17 features when under the appropriate
      compiler mode, as we were already doing for a few things (like
      index_sequence).  Most of these aren't saving much (the implementation
      for enable_if_t, for example, is trivial), but I think it makes the
      intention of the code instantly clear.  It also enables MSVC's native
      std::index_sequence support.
      Jason Rhinelander committed
    • Add gcc-7 build from debian experimental · a3d41d10
      Add a build using g++-7 snapshot from debian experimental.  This build
      is set to allow failures without triggering an overall build failure
      (since this is an experimental compiler with experimental support for a
      future C++ standard).
      Jason Rhinelander committed
    • Support binding noexcept function/methods in C++17 · 6e036e78
      When compiling in C++17 mode the noexcept specifier is part of the
      function type.  This causes a failure in pybind11 because, by omitting
      a noexcept specifier when deducing function return and argument types,
      we are implicitly making `noexcept(false)` part of the type.
      
      This means that functions with `noexcept` fail to match the function
      templates in cpp_function (and other places), and we get compilation
      failure (we end up trying to fit it into the lambda function version,
      which fails since a function pointer has no `operator()`).
      
      We can, however, deduce the true/false `B` in noexcept(B), so we don't
      need to add a whole other set of overloads, but need to deduce the extra
      argument when under C++17.  That will *not* work under pre-C++17,
      however.
      
      This commit adds two macros to fix the problem: under C++17 (with the
      appropriate feature macro set) they provide an extra `bool NoExceptions`
      template argument and provide the `noexcept(NoExceptions)` deduced
      specifier.  Under pre-C++17 they expand to nothing.
      
      This is needed to compile pybind11 with gcc7 under -std=c++17.
      Jason Rhinelander committed
    • Fix test compilation when both optional's exist · 79de508e
      gcc 7 has both std::experimental::optional and std::optional, but this
      breaks the test compilation as we are trying to use the same `opt_int`
      type alias for both.
      Jason Rhinelander committed
    • Remove useless `convert` argument from argument_loader · 12ce07a2
      Since the argument loader split off from the tuple converter, it is
      never called with a `convert` argument set to anything but true.  This
      removes the argument entirely, passing a literal `true` from within
      `argument_loader` to the individual value casters.
      Jason Rhinelander committed
    • Work around gcc 7 ICE · 23e59c86
      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
    • Silence warnings from eigen under g++ 7 · cb637709
      -Wint-in-bool-context triggers many warnings when compiling eigen code,
      so disable it locally in eigen.h.
      Jason Rhinelander committed