1. 19 Oct, 2021 1 commit
  2. 08 Oct, 2021 1 commit
  3. 22 Sep, 2021 1 commit
  4. 17 Sep, 2021 1 commit
  5. 26 Aug, 2021 1 commit
  6. 12 Jul, 2021 2 commits
  7. 17 Jun, 2021 1 commit
  8. 08 Dec, 2020 1 commit
  9. 15 Oct, 2020 1 commit
  10. 03 Oct, 2020 1 commit
  11. 14 Sep, 2020 1 commit
  12. 09 Sep, 2020 1 commit
  13. 04 Sep, 2020 1 commit
  14. 23 Aug, 2020 1 commit
  15. 22 Aug, 2020 1 commit
    • jbarlow83's avatar
      Improve documentation of Python and C++ exceptions (#2408) · b8863698
      jbarlow83 authored
      The main change is to treat error_already_set as a separate category
      of exception that arises in different circumstances and needs to be
      handled differently. The asymmetry between Python and C++ exceptions
      is further emphasized.
      b8863698
  16. 20 Aug, 2020 1 commit
  17. 04 Aug, 2020 1 commit
  18. 23 Jul, 2020 1 commit
  19. 20 Jul, 2020 1 commit
  20. 15 Jul, 2020 1 commit
    • Kota Yamaguchi's avatar
      Fix undefined memoryview format (#2223) · e2488698
      Kota Yamaguchi authored
      * Fix undefined memoryview format
      
      * Add missing <algorithm> header
      
      * Add workaround for py27 array compatibility
      
      * Workaround py27 memoryview behavior
      
      * Fix memoryview constructor from buffer_info
      
      * Workaround PyMemoryView_FromMemory availability in py27
      
      * Fix up memoryview tests
      
      * Update memoryview test from buffer to check signedness
      
      * Use static factory method to create memoryview
      
      * Remove ndim arg from memoryview::frombuffer and add tests
      
      * Allow ndim=0 memoryview and documentation fixup
      
      * Use void* to align to frombuffer method signature
      
      * Add const variants of frombuffer and frommemory
      
      * Add memory view section in doc
      
      * Fix docs
      
      * Add test for null buffer
      
      * Workaround py27 nullptr behavior in test
      
      * Rename frombuffer to from_buffer
      e2488698
  21. 30 Jun, 2020 1 commit
  22. 28 Aug, 2018 1 commit
  23. 24 Jun, 2018 1 commit
  24. 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
  25. 13 Sep, 2017 1 commit
  26. 25 Aug, 2017 1 commit
  27. 27 Jun, 2017 1 commit
  28. 29 May, 2017 1 commit
    • Dean Moldovan's avatar
      Replace PYBIND11_PLUGIN with PYBIND11_MODULE · 443ab594
      Dean Moldovan authored
      This commit also adds `doc()` to `object_api` as a shortcut for the
      `attr("__doc__")` accessor.
      
      The module macro changes from:
      ```c++
      PYBIND11_PLUGIN(example) {
          pybind11::module m("example", "pybind11 example plugin");
          m.def("add", [](int a, int b) { return a + b; });
          return m.ptr();
      }
      ```
      
      to:
      
      ```c++
      PYBIND11_MODULE(example, m) {
          m.doc() = "pybind11 example plugin";
          m.def("add", [](int a, int b) { return a + b; });
      }
      ```
      
      Using the old macro results in a deprecation warning. The warning
      actually points to the `pybind11_init` function (since attributes
      don't bind to macros), but the message should be quite clear:
      "PYBIND11_PLUGIN is deprecated, use PYBIND11_MODULE".
      443ab594
  29. 28 May, 2017 1 commit
  30. 27 May, 2017 1 commit
  31. 25 May, 2017 1 commit
    • Jason Rhinelander's avatar
      vectorize: pass-through of non-vectorizable args · f3ce00ea
      Jason Rhinelander authored
      This extends py::vectorize to automatically pass through
      non-vectorizable arguments.  This removes the need for the documented
      "explicitly exclude an argument" workaround.
      
      Vectorization now applies to arithmetic, std::complex, and POD types,
      passed as plain value or by const lvalue reference (previously only
      pass-by-value types were supported).  Non-const lvalue references and
      any other types are passed through as-is.
      
      Functions with rvalue reference arguments (whether vectorizable or not)
      are explicitly prohibited: an rvalue reference is inherently not
      something that can be passed multiple times and is thus unsuitable to
      being in a vectorized function.
      
      The vectorize returned value is also now more sensitive to inputs:
      previously it would return by value when all inputs are of size 1; this
      is now amended to having all inputs of size 1 *and* 0 dimensions.  Thus
      if you pass in, for example, [[1]], you get back a 1x1, 2D array, while
      previously you got back just the resulting single value.
      
      Vectorization of member function specializations is now also supported
      via `py::vectorize(&Class::method)`; this required passthrough support
      for the initial object pointer on the wrapping function pointer.
      f3ce00ea
  32. 10 May, 2017 2 commits
    • Bruce Merry's avatar
      Allow std::complex field with PYBIND11_NUMPY_DTYPE (#831) · b82c0f0a
      Bruce Merry authored
      This exposed a few underlying issues:
      
      1. is_pod_struct was too strict to allow this. I've relaxed it to
      require only trivially copyable and standard layout, rather than POD
      (which additionally requires a trivial constructor, which std::complex
      violates).
      
      2. format_descriptor<std::complex<T>>::format() returned numpy format
      strings instead of PEP3118 format strings, but register_dtype
      feeds format codes of its fields to _dtype_from_pep3118. I've changed it
      to return PEP3118 format codes. format_descriptor is a public type, so
      this may be considered an incompatible change.
      
      3. register_structured_dtype tried to be smart about whether to mark
      fields as unaligned (with ^). However, it's examining the C++ alignment,
      rather than what numpy (or possibly PEP3118) thinks the alignment should
      be. For complex values those are different. I've made it mark all fields
      as ^ unconditionally, which should always be safe even if they are
      aligned, because we explicitly mark the padding.
      b82c0f0a
    • Bruce Merry's avatar
      Support arrays inside PYBIND11_NUMPY_DTYPE (#832) · 8e0d832c
      Bruce Merry authored
      Resolves #800.
      
      Both C++ arrays and std::array are supported, including mixtures like
      std::array<int, 2>[4]. In a multi-dimensional array of char, the last
      dimension is used to construct a numpy string type.
      8e0d832c
  33. 08 May, 2017 1 commit
  34. 07 May, 2017 3 commits
    • Cris Luengo's avatar
    • Jason Rhinelander's avatar
      Use numpy rather than Eigen for copying · b68959e8
      Jason Rhinelander authored
      We're current copy by creating an Eigen::Map into the input numpy
      array, then assigning that to the basic eigen type, effectively having
      Eigen do the copy.  That doesn't work for negative strides, though:
      Eigen doesn't allow them.
      
      This commit makes numpy do the copying instead by allocating the eigen
      type, then having numpy copy from the input array into a numpy reference
      into the eigen object's data.  This also saves a copy when type
      conversion is required: numpy can do the conversion on-the-fly as part
      of the copy.
      
      Finally this commit also makes non-reference parameters respect the
      convert flag, declining the load when called in a noconvert pass with a
      convertible, but non-array input or an array with the wrong dtype.
      b68959e8
    • Cris Luengo's avatar
      d400f60c
  35. 28 Mar, 2017 1 commit
  36. 22 Mar, 2017 1 commit