1. Nov 09, 2018
  2. Oct 31, 2018
  3. Oct 30, 2018
    • Wenzel Jakob's avatar
      Support C++17 aligned new statement · 58252039
      Wenzel Jakob authored
      This patch makes pybind11 aware of nonstandard alignment requirements in
      bound types and passes on this information to C++17 aligned 'new'
      operator. Pre-C++17, the behavior is unchanged.
      58252039
  4. Oct 24, 2018
  5. Oct 15, 2018
  6. Oct 11, 2018
  7. Oct 02, 2018
  8. Sep 27, 2018
  9. Sep 26, 2018
    • oremanj's avatar
      Fix potential crash when calling an overloaded function (#1327) · e7761e33
      oremanj authored
      * Fix potential crash when calling an overloaded function
      
      The crash would occur if:
      - dispatcher() uses two-pass logic (because the target is overloaded and some arguments support conversions)
      - the first pass (with conversions disabled) doesn't find any matching overload
      - the second pass does find a matching overload, but its return value can't be converted to Python
      
      The code for formatting the error message assumed `it` still pointed to the selected overload,
      but during the second-pass loop `it` was nullptr. Fix by setting `it` correctly if a second-pass
      call returns a nullptr `handle`. Add a new test that segfaults without this fix.
      
      * Make overload iteration const-correct so we don't have to iterate again on second-pass error
      
      * Change test_error_after_conversions dependencies to local classes/variables
      e7761e33
  10. Sep 14, 2018
  11. Sep 12, 2018
    • Semen Yesylevskyy's avatar
      Info about inconsistent detection of Python version between pybind11 … (#1093) · ef13fb2e
      Semen Yesylevskyy authored
      * Info about inconsistent detection of Python version between pybind11 and CMake in FAQ
      ef13fb2e
    • Wenzel Jakob's avatar
      enum_: move most functionality to a non-template implementation · f4245181
      Wenzel Jakob authored
      This commit addresses an inefficiency in how enums are created in
      pybind11. Most of the enum_<> implementation is completely generic --
      however, being a template class, it ended up instantiating vast amounts
      of essentially identical code in larger projects with many enums.
      
      This commit introduces a generic non-templated helper class that is
      compatible with any kind of enumeration. enum_ then becomes a thin
      wrapper around this new class.
      
      The new enum_<> API is designed to be 100% compatible with the old one.
      f4245181
    • Wenzel Jakob's avatar
      relax operator[] for tuples, lists, and sequences · b4b22924
      Wenzel Jakob authored
      object_api::operator[] has a powerful overload for py::handle that can
      accept slices, tuples (for NumPy), etc.
      
      Lists, sequences, and tuples provide their own specialized operator[],
      which unfortunately disables this functionality. This is accidental, and
      the purpose of this commit is to re-enable the more general behavior.
      
      This commit is tangentially related to the previous one in that it makes
      py::handle/py::object et al. behave more like their Python counterparts.
      b4b22924
    • Wenzel Jakob's avatar
      object_api: support the number protocol · 06710020
      Wenzel Jakob authored
      This commit revamps the object_api class so that it maps most C++
      operators to their Python analogs. This makes it possible to, e.g.
      perform arithmetic using a py::int_ or py::array.
      06710020
  12. Sep 11, 2018
  13. Sep 08, 2018
  14. Aug 29, 2018
  15. Jul 20, 2018
    • Jason Rhinelander's avatar
      Fix compatibility with catch v2 · f7bc18f5
      Jason Rhinelander authored
      Catch v2 changed the `run(...)` signature to take a `char *argv[]`,
      arguing partly that technically a `char *argv[]` type is the correct
      `main()` signature rather than `const char *argv[]`.
      
      Dropping the `const` here doesn't appear to cause any problems with
      catch v1 (tested against both the cmake-downloaded 1.9.3 and Debian's
      1.12.1 package) so we can follow suit.
      f7bc18f5
  16. Jul 17, 2018
    • Wenzel Jakob's avatar
      stl.h: propagate return value policies to type-specific casters (#1455) · cbd16a82
      Wenzel Jakob authored
      * stl.h: propagate return value policies to type-specific casters
      
      Return value policies for containers like those handled in in 'stl.h'
      are currently broken.
      
      The problem is that detail::return_value_policy_override<C>::policy()
      always returns 'move' when given a non-pointer/reference type, e.g.
      'std::vector<...>'.
      
      This is sensible behavior for custom types that are exposed via
      'py::class_<>', but it does not make sense for types that are handled by
      other type casters (STL containers, Eigen matrices, etc.).
      
      This commit changes the behavior so that
      detail::return_value_policy_override only becomes active when the type
      caster derives from type_caster_generic.
      
      Furthermore, the override logic is called recursively in STL type
      casters to enable key/value-specific behavior.
      cbd16a82
    • Yannick Jadoul's avatar
      Switching deprecated Thread Local Storage (TLS) usage in Python 3.7 to Thread... · b4719a60
      Yannick Jadoul authored
      Switching deprecated Thread Local Storage (TLS) usage in Python 3.7 to Thread Specific Storage (TSS) (#1454)
      
      * Switching deprecated Thread Local Storage (TLS) usage in Python 3.7 to Thread Specific Storage (TSS)
      
      * Changing Python version from 3.6 to 3.7 for Travis CI, to match brew's version of Python 3
      
      * Introducing PYBIND11_ macros to switch between TLS and TSS API
      b4719a60
    • Boris Dalstein's avatar
      Fix typo in doc: build-in -> built-in · b30734ee
      Boris Dalstein authored
      b30734ee
    • Dennis Luxen's avatar
      Untangle cast logic to not implicitly require castability (#1442) · 221fb1e1
      Dennis Luxen authored
      The current code requires implicitly that integral types are cast-able to floating point. In case of strongly-typed integrals (e.g. as explained at http://www.ilikebigbits.com/blog/2014/5/6/type-safe-identifiers-in-c) this is not always the case.
      
      This commit uses SFINAE to move the numeric conversions into separate `cast()` implementations to avoid the issue.
      221fb1e1
  17. Jun 24, 2018