1. 21 Mar, 2017 1 commit
    • Dean Moldovan's avatar
      Throw an exception when attempting to load an incompatible holder · cd3d1fc7
      Dean Moldovan authored
      Instead of a segfault. Fixes #751.
      
      This covers the case of loading a custom holder from a default-holder
      instance. Attempting to load one custom holder from a different custom
      holder (i.e. not `std::unique_ptr`) yields undefined behavior, just as
      #588 established for inheritance.
      cd3d1fc7
  2. 31 Jan, 2017 1 commit
    • Dean Moldovan's avatar
      Improve custom holder support (#607) · ec009a7c
      Dean Moldovan authored
      * Abstract away some holder functionality (resolve #585)
      
      Custom holder types which don't have `.get()` can select the correct
      function to call by specializing `holder_traits`.
      
      * Add support for move-only holders (fix #605)
      ec009a7c
  3. 15 Dec, 2016 1 commit
  4. 07 Dec, 2016 1 commit
  5. 20 Nov, 2016 1 commit
  6. 04 Sep, 2016 1 commit
    • Jason Rhinelander's avatar
      Make unique_ptr's with non-default deleters work · a6495af8
      Jason Rhinelander authored
      Currently pybind11 only supports std::unique_ptr<T> holders by default
      (other holders can, of course, be declared using the macro).  PR #368
      added a `py::nodelete` that is intended to be used as:
      
          py::class_<Type, std::unique_ptr<Type, py::nodelete>> c("Type");
      
      but this doesn't work out of the box.  (You could add an explicit
      holder type declaration, but this doesn't appear to have been the
      intention of the commit).
      
      This commit fixes it by generalizing the unique_ptr type_caster to take
      both the type and deleter as template arguments, so that *any*
      unique_ptr instances are now automatically handled by pybind.  It also
      adds a test to test_smart_ptr, testing both that py::nodelete (now)
      works, and that the object is indeed not deleted as intended.
      a6495af8
  7. 19 Aug, 2016 1 commit
    • Dean Moldovan's avatar
      Port tests to pytest · a0c1ccf0
      Dean Moldovan authored
      Use simple asserts and pytest's powerful introspection to make testing
      simpler. This merges the old .py/.ref file pairs into simple .py files
      where the expected values are right next to the code being tested.
      
      This commit does not touch the C++ part of the code and replicates the
      Python tests exactly like the old .ref-file-based approach.
      a0c1ccf0