1. 14 Mar, 2017 3 commits
  2. 13 Mar, 2017 3 commits
  3. 12 Mar, 2017 4 commits
    • Add MSVC 2017 cpp_function ICE workaround · 2d965d43
      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.
      Jason Rhinelander committed
    • Fix readthedocs build (#721) · b7017c3d
      RTD updated their build environment which broke the 1.8.14.dev build of
      doxygen that we were using. The update also breaks the conda-forge build
      of 1.8.13 (but that version has other issues).
      
      Luckily, the RTD update did bring their doxygen version up to 1.8.11
      which is enough to parse the C++11 code we need (ref qualifiers) and it
      also avoids the segfault found in 1.8.13.
      
      Since we're using the native doxygen, conda isn't required anymore and
      we can simplify the RTD configuration.
      
      [skip ci]
      Dean Moldovan committed
    • Call PyUnicode_DecodeUTF* directly · ee929639
      Some versions of Python 2.7 reportedly (#713) have issues with
      PyUnicode_Decode being passed the encoding string, so just skip it
      entirely by calling the PyUnicode_DecodeUTF* function directly.  This
      will also be slightly more efficient by avoiding having to check the
      encoding string, and (for python 2) going through the unicode class's
      decode (python 3 fast-tracks this for all utf-{8,16,32} encodings;
      python 2 only fast-tracked for the exact string "utf-8", which we
      weren't passing anyway (we had "utf8")).
      
      This doesn't work for PyPy, however: its `PyUnicode_DecodeUTF{8,16,32}`
      appear rather broken: the UTF8 one segfaults, while the 16/32 require
      recasting into a non-const `char *` (and might segfault; I didn't get
      far enough to find out).  Just avoid the whole thing by keeping the
      encoding-passed-as-string version for PyPy, which seems to work
      reliably.
      Jason Rhinelander committed
    • Fix for floating point durations · e5456c22
      The duration calculation was using %, but that's only supported on
      duration objects when the arithmetic type supports %, and hence fails
      for floats.  Fixed by subtracting off the calculated values instead.
      Jason Rhinelander committed
  4. 10 Mar, 2017 3 commits
    • Add failure-allowed clang-4.0/libc++-4.0 build · 28a837a0
      This adds a linux docker clang 4.0 with libc++ and c++1z build.
      Jason Rhinelander committed
    • Minor pytest maintenance (#702) · d47febcb
      * Add `pytest.ini` config file and set default options there instead of
        in `CMakeLists.txt` (command line arguments).
      
      * Change all output capture from `capfd` (filedescriptors) to `capsys`
        (Python's `sys.stdout` and `sys.stderr`). This avoids capturing
        low-level C errors, e.g. from the debug build of Python.
      
      * Set pytest minimum version to 3.0 to make it easier to use new
        features. Removed conditional use of `excinfo.match()`.
      
      * Clean up some leftover function-level `@pytest.requires_numpy`.
      Dean Moldovan committed
    • Use trusty for travis-ci pypy build (#716) · 303ee29d
      Nightlies for pypy no longer run on Ubuntu 12.04; change the pypy build
      distribution to the travis-ci trusty (i.e. 14.04) beta container.
      
      The pypy build was also installing numpy and scipy for the *system*
      python version, which was pointless; this also adds a guard to the
      eigen/numpy/scipy install code with a !PYPY check.
      Jason Rhinelander committed
  5. 08 Mar, 2017 1 commit
  6. 06 Mar, 2017 1 commit
  7. 04 Mar, 2017 2 commits
  8. 03 Mar, 2017 2 commits
  9. 01 Mar, 2017 1 commit
    • fix python version check (#705) · 11c9f32c
      Commit 11a337f1 added major and minor python version
      checking to cast.h but does not use the macros defined
      via the Python.h inclusion. This may be due to an
      intention to use the variables defined by the cmake
      module FindPythonInterpreter, but nothing in the
      pybind11 repo does anything to convert the cmake
      variables to preprocessor defines.
      eirrgang committed
  10. 28 Feb, 2017 1 commit
  11. 27 Feb, 2017 2 commits
  12. 26 Feb, 2017 7 commits
  13. 24 Feb, 2017 10 commits
    • Move requires_numpy, etc. decorators to globals · 2a757844
      test_eigen.py and test_numpy_*.py have the same
      @pytest.requires_eigen_and_numpy or @pytest.requires_numpy on every
      single test; this changes them to use pytest's global `pytestmark = ...`
      instead to disable the entire module when numpy and/or eigen aren't
      available.
      Jason Rhinelander committed
    • Eigen<->numpy referencing support · 17d0283e
      This commit largely rewrites the Eigen dense matrix support to avoid
      copying in many cases: Eigen arguments can now reference numpy data, and
      numpy objects can now reference Eigen data (given compatible types).
      
      Eigen::Ref<...> arguments now also make use of the new `convert`
      argument use (added in PR #634) to avoid conversion, allowing
      `py::arg().noconvert()` to be used when binding a function to prohibit
      copying when invoking the function.  Respecting `convert` also means
      Eigen overloads that avoid copying will be preferred during overload
      resolution to ones that require copying.
      
      This commit also rewrites the Eigen documentation and test suite to
      explain and test the new capabilities.
      Jason Rhinelander committed
    • Add an ability to avoid forcing rvp::move · 546f6fce
      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 committed
    • Change array's writeable exception to a ValueError · fd751703
      Numpy raises ValueError when attempting to modify an array, while
      py::array is raising a RuntimeError.  This changes the exception to a
      std::domain_error, which gets mapped to the expected ValueError in
      python.
      Jason Rhinelander committed
    • array: fix base handling · f86dddf7
      numpy arrays aren't currently properly setting base: by setting `->base`
      directly, the base doesn't follow what numpy expects and documents (that
      is, following chained array bases to the root array).
      
      This fixes the behaviour by using numpy's PyArray_SetBaseObject to set
      the base instead, and then updates the tests to reflect the fixed
      behaviour.
      Jason Rhinelander committed
    • Change numpy constants to non-deprecated versions · 88fff9d1
      A few of pybind's numpy constants are using the numpy-deprecated names
      (without "ARRAY_" in them); updated our names to be consistent with
      current numpy code.
      Jason Rhinelander committed
    • Make is_template_base_of ignore cv qualification · 7d46c6f6
      `is_template_base_of<T>` fails when `T` is `const` (because its
      implementation relies on being able to convert a `T*` to a `Base<U>*`,
      which won't work when `T` is const).
      
      (This also agrees with std::is_base_of, which ignores cv qualification.)
      Jason Rhinelander committed
    • Eigen: fix partially-fixed matrix conversion · d9d224f2
      Currently when we do a conversion between a numpy array and an Eigen
      Vector, we allow the conversion only if the Eigen type is a
      compile-time vector (i.e. at least one dimension is fixed at 1 at
      compile time), or if the type is dynamic on *both* dimensions.
      
      This means we can run into cases where MatrixXd allow things that
      conforming, compile-time sizes does not: for example,
      `Matrix<double,4,Dynamic>` is currently not allowed, even when assigning
      from a 4-element vector, but it *is* allowed for a
      `Matrix<double,Dynamic,Dynamic>`.
      
      This commit also reverts the current behaviour of using the matrix's
      storage order to determine the structure when the Matrix is fully
      dynamic (i.e. in both dimensions).  Currently we assign to an eigen row
      if the storage order is row-major, and column otherwise: this seems
      wrong (the storage order has nothing to do with the shape!).  While
      numpy doesn't distinguish between a row/column vector, Eigen does, but
      it makes more sense to consistently choose one than to produce
      something with a different shape based on the intended storage layout.
      Jason Rhinelander committed
    • Show kwargs in failed method invocation · 231e1678
      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 committed