1. 24 Nov, 2017 1 commit
  2. 22 Nov, 2017 2 commits
    • Jason Rhinelander's avatar
      Clean up eigen download code (and bump to 3.3.4) · 086d53e8
      Jason Rhinelander authored
      This changes the travis-ci eigen download code to extract the tar on the
      fly (rather than saving to a file first), and extracts into an `eigen`
      directory rather than using upstream's `eigen-eigen-xxxxx` directory.
      
      This also bumps the travis-ci eigen release to 3.3.4, in an attempt to
      see if it fixed the -Wdeprecated warnings (it did not); the build setup
      cleanup seems worth committing anyway.
      086d53e8
    • Francesco Biscani's avatar
      Add -Wdeprecated to test suite and fix associated warnings (#1191) · ba33b2fc
      Francesco Biscani authored
      This commit turns on `-Wdeprecated` in the test suite and fixes several
      associated deprecation warnings that show up as a result:
      
      - in C++17 `static constexpr` members are implicitly inline; our
        redeclaration (needed for C++11/14) is deprecated in C++17.
      
      - various test suite classes have destructors and rely on implicit copy
        constructors, but implicit copy constructor definitions when a
        user-declared destructor is present was deprecated in C++11.
      
      - Eigen also has various implicit copy constructors, so just disable
        `-Wdeprecated` in `eigen.h`.
      ba33b2fc
  3. 17 Nov, 2017 2 commits
  4. 16 Nov, 2017 1 commit
  5. 07 Nov, 2017 2 commits
    • Ted Drain's avatar
      Added write only property functions for issue #1142 (#1144) · 0a0758ce
      Ted Drain authored
      py::class_<T>'s `def_property` and `def_property_static` can now take a
      `nullptr` as the getter to allow a write-only property to be established
      (mirroring Python's `property()` built-in when `None` is given for the
      getter).
      
      This also updates properties to use the new nullptr constructor internally.
      0a0758ce
    • Jason Rhinelander's avatar
      __qualname__ and nested class naming fixes (#1171) · 71178922
      Jason Rhinelander authored
      A few fixes related to how we set `__qualname__` and how we show the
      type name in function signatures:
      
      - `__qualname__` isn't supposed to have the module name at the
      beginning, but we've been putting it there.  This removes it, while
      keeping the `Nested.Class` name chaining.
      
      - print `__module__.__qualname__` rather than `type->tp_name`; the
      latter doesn't work properly for nested classes, so we would get
      `module.B` rather than `module.A.B` for a class `B` with parent `A`.
      This also unifies the Python 3 and PyPy code.  Fixes #1166.
      
      - This now sets a `__qualname__` attribute on the type (as would happen
      in Python 3.3+) for Python <3.3, including PyPy.  While not particularly
      important to have in earlier Python versions, it's useful for us to be
      able to extracted the nested name, which is why `__qualname__` was
      invented in the first place.
      
      - Added tests for the above.
      71178922
  6. 02 Nov, 2017 1 commit
    • Unknown's avatar
      Trivial typos · 0b3f44eb
      Unknown authored
      Non-user facing. 
      Found using `codespell -q 3`
      0b3f44eb
  7. 25 Oct, 2017 1 commit
  8. 24 Oct, 2017 1 commit
  9. 22 Oct, 2017 2 commits
    • Jason Rhinelander's avatar
      Miscellaneous travis-ci updates/fixes · 835fa9bc
      Jason Rhinelander authored
      - For the debian/buster docker build (GCC 7/C++17) install and use the
        system `catch` package; this also renames "COMPILER_PACKAGES" to
        "EXTRA_PACKAGES" since it now contains a non-compiler package.
      
      - Add a status message indicating the catch version being used for
        compiling the embedded tests
      
      - Simplify some bash code by using VAR+=" foo" to append (rather than
        VAR="${VAR} foo"
      
      - Fix CMAKE_INCLUDE_PATH appending: it was prepending the ':' but not
        the existing $CMAKE_INCLUDE_PATH value and so would end up with
        ":/eigen-path" if CMAKE_INCLUDE_PATH was already set.  (This wasn't
        bug that was actually noticed since currently nothing else sets it).
      835fa9bc
    • Jason Rhinelander's avatar
      Build /permissive- under VS2017 · a582d6c7
      Jason Rhinelander authored
      Building with the (VS2017) /permissive- flag puts the compiler into
      stricter standards-compliant mode.  It shouldn't cause the compiler to
      work differently--it just disallows some non-conforming code--so should
      be perfectly fine for the test suite under all VS2017 builds.
      
      This commit also fixes one failure under non-permissive mode.
      a582d6c7
  10. 12 Oct, 2017 3 commits
    • Jason Rhinelander's avatar
      Fix 2D Nx1/1xN inputs to eigen dense vector args · 6a81dbbb
      Jason Rhinelander authored
      This fixes a bug introduced in b68959e8
      when passing in a two-dimensional, but conformable, array as the value
      for a compile-time Eigen vector (such as VectorXd or RowVectorXd).  The
      commit switched to using numpy to copy into the eigen data, but this
      broke the described case because numpy refuses to broadcast a (N,1)
      into a (N).
      
      This commit fixes it by squeezing the input array whenever the output
      array is 1-dimensional, which will let the problematic case through.
      (This shouldn't squeeze inappropriately as dimension compatibility is
      already checked for conformability before getting to the copy code).
      6a81dbbb
    • Jason Rhinelander's avatar
      Add informative compilation failure for method_adaptor failures · 7672292e
      Jason Rhinelander authored
      When using `method_adaptor` (usually implicitly via a `cl.def("f",
      &D::f)`) a compilation failure results if `f` is actually a method of
      an inaccessible base class made public via `using`, such as:
      
          class B { public: void f() {} };
          class D : private B { public: using B::f; };
      
      pybind deduces `&D::f` as a `B` member function pointer.  Since the base
      class is inaccessible, the cast in `method_adaptor` from a base class
      member function pointer to derived class member function pointer isn't
      valid, and a cast failure results.
      
      This was sort of a regression in 2.2, which introduced `method_adaptor`
      to do the expected thing when the base class *is* accessible.  It wasn't
      actually something that *worked* in 2.1, though: you wouldn't get a
      compile-time failure, but the method was not callable (because the `D *`
      couldn't be cast to a `B *` because of the access restriction).  As a
      result, you'd simply get a run-time failure if you ever tried to call
      the function (this is what #855 fixed).
      
      Thus the change in 2.2 essentially promoted a run-time failure to a
      compile-time failure, so isn't really a regression.
      
      This commit simply adds a `static_assert` with an accessible-base-class
      check so that, rather than just a cryptic cast failure, you get
      something more informative (along with a suggestion for a workaround).
      
      The workaround is to use a lambda, e.g.:
      
          class Derived : private Base {
          public:
              using Base::f;
          };
      
          // In binding code:
          //cl.def("f", &Derived::f); // fails: &Derived::f is actually a base
                                      // class member function pointer
          cl.def("f", [](Derived &self) { return self.f(); });
      
      This is a bit of a nuissance (especially if there are a bunch of
      arguments to forward), but I don't really see another solution.
      
      Fixes #1124
      7672292e
    • Jason Rhinelander's avatar
      Fix `char &` arguments being non-bindable · 1b08df58
      Jason Rhinelander authored
      This changes the caster to return a reference to a (new) local `CharT`
      type caster member so that binding lvalue-reference char arguments
      works (currently it results in a compilation failure).
      
      Fixes #1116
      1b08df58
  11. 10 Oct, 2017 1 commit
  12. 08 Oct, 2017 1 commit
  13. 28 Sep, 2017 1 commit
  14. 21 Sep, 2017 1 commit
    • Ansgar Burchardt's avatar
      correct stride in matrix example and test · a22dd2d1
      Ansgar Burchardt authored
      This also matches the Eigen example for the row-major case.
      
      This also enhances one of the tests to trigger a failure (and fixes it in the PR).  (This isn't really a flaw in pybind itself, but rather fixes wrong code in the test code and docs).
      a22dd2d1
  15. 20 Sep, 2017 2 commits
  16. 16 Sep, 2017 3 commits
    • Dean Moldovan's avatar
      Simplify function signature annotation and parsing · 0aef6422
      Dean Moldovan authored
      `type_descr` is now applied only to the final signature so that it only
      marks the argument types, but not nested types (e.g. for tuples) or
      return types.
      0aef6422
    • Dean Moldovan's avatar
      Use semi-constexpr signatures on MSVC · 56613945
      Dean Moldovan authored
      MSCV does not allow `&typeid(T)` in constexpr contexts, but the string
      part of the type signature can still be constexpr. In order to avoid
      `typeid` as long as possible, `descr` is modified to collect type
      information as template parameters instead of constexpr `typeid`.
      The actual `std::type_info` pointers are only collected in the end,
      as a `constexpr` (gcc/clang) or regular (MSVC) function call.
      
      Not only does it significantly reduce binary size on MSVC, gcc/clang
      benefit a little bit as well, since they can skip some intermediate
      `std::type_info*` arrays.
      56613945
    • Dean Moldovan's avatar
      Make it possible to generate constexpr signatures in C++11 mode · c10ac6cf
      Dean Moldovan authored
      The current C++14 constexpr signatures don't require relaxed constexpr,
      but only `auto` return type deduction. To get around this in C++11,
      the type caster's `name()` static member functions are turned into
      `static constexpr auto` variables.
      c10ac6cf
  17. 14 Sep, 2017 1 commit
  18. 13 Sep, 2017 4 commits
  19. 12 Sep, 2017 2 commits
    • Dean Moldovan's avatar
      Make TypeErrors more informative when an optional header is missing · 2b4477eb
      Dean Moldovan authored
      E.g. trying to convert a `list` to a `std::vector<int>` without
      including <pybind11/stl.h> will now raise an error with a note that
      suggests checking the headers.
      
      The note is only appended if `std::` is found in the function
      signature. This should only be the case when a header is missing.
      E.g. when stl.h is included, the signature would contain `List[int]`
      instead of `std::vector<int>` while using stl_bind.h would produce
      something like `MyVector`. Similarly for `std::map`/`Dict`, `complex`,
      `std::function`/`Callable`, etc.
      
      There's a possibility for false positives, but it's pretty low.
      2b4477eb
    • Gunnar Läthén's avatar
      c64e6b16
  20. 11 Sep, 2017 1 commit
  21. 10 Sep, 2017 4 commits
  22. 08 Sep, 2017 3 commits