1. 11 Jun, 2019 5 commits
  2. 10 Jun, 2019 2 commits
  3. 12 May, 2019 1 commit
  4. 06 Apr, 2019 1 commit
    • Henry Schreiner's avatar
      CI fixes (#1744) · ae951ca0
      Henry Schreiner authored
      * Fix warning that not including a cmake source or build dir will be a fatal error (it is now on newest CMakes)
          * Fixes appveyor
      * Travis uses CMake 3.9 for more than a year now
      * Travis dropped sudo: false in December
      * Dropping Sphinx 2
      - clang7: Suppress self-assign warnings; fix missing virtual dtors
      - pypy:
        - Keep old version (newer stuff breaks)
        - Pin packages to extra index for speed
      - travis:
        - Make docker explicit; remove docker if not needed
        - Make commands more verbose (for debugging / repro)
        - Make Ubuntu dist explicit per job
      - Fix Windows
      - Add names to travis
      ae951ca0
  5. 04 Feb, 2019 3 commits
  6. 03 Jan, 2019 1 commit
  7. 01 Dec, 2018 1 commit
  8. 16 Nov, 2018 1 commit
    • voxmea's avatar
      Adds type_caster support for std::deque. (#1609) · 17983e74
      voxmea authored
      * Adds std::deque to the types supported by list_caster in stl.h.
      * Adds a new test_deque test in test_stl.{py,cpp}.
      * Updates the documentation to include std::deque as a default
        supported type.
      17983e74
  9. 11 Nov, 2018 2 commits
    • Trevor Laughlin's avatar
      Enable unique_ptr holder with mixed Deleters between base and derived types (#1353) · 63c2a972
      Trevor Laughlin authored
      * Check default holder
      
      -Recognize "std::unique_ptr<T, D>" as a default holder even if "D" doesn't match between base and derived holders
      
      * Add test for unique_ptr<T, D> change
      63c2a972
    • Wenzel Jakob's avatar
      fix py::cast<void *> (#1605) · cea42467
      Wenzel Jakob authored
      Pybind11 provides a cast operator between opaque void* pointers on the
      C++ side and capsules on the Python side. The py::cast<void *>
      expression was not aware of this possibility and incorrectly triggered a
      compile-time assertion ("Unable to cast type to reference: value is
      local to type caster") that is now fixed.
      cea42467
  10. 09 Nov, 2018 3 commits
  11. 24 Oct, 2018 1 commit
  12. 11 Oct, 2018 1 commit
    • Allan Leal's avatar
      Fix for Issue #1258 (#1298) · e76dff77
      Allan Leal authored
      * Fix for Issue #1258
      
      list_caster::load method will now check for a Python string and prevent its automatic conversion to a list.
      This should fix the issue "pybind11/stl.h converts string to vector<string> #1258" (https://github.com/pybind/pybind11/issues/1258)
      
      * Added tests for fix of issue #1258
      
      * Changelog: stl string auto-conversion
      e76dff77
  13. 02 Oct, 2018 1 commit
  14. 25 Sep, 2018 1 commit
    • 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
  15. 11 Sep, 2018 5 commits
    • 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
    • Krzysztof Fornalczyk's avatar
      check for already existing enum value added; added test (#1453) · 5c8746ff
      Krzysztof Fornalczyk authored
      * check for already existing enum value added; added test
      
      * added enum value name to exception message
      
      * test for defining enum with multiple identical names moved to test_enum.cpp/py
      5c8746ff
    • Wenzel Jakob's avatar
      44e39e0d
  16. 29 Aug, 2018 2 commits
  17. 28 Aug, 2018 2 commits
  18. 19 Jul, 2018 1 commit
    • 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
  19. 17 Jul, 2018 1 commit
    • 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
  20. 24 Jun, 2018 1 commit
  21. 18 May, 2018 1 commit
  22. 06 May, 2018 2 commits
  23. 14 Apr, 2018 1 commit
    • oremanj's avatar
      Add basic support for tag-based static polymorphism (#1326) · fd9bc8f5
      oremanj authored
      * Add basic support for tag-based static polymorphism
      
      Sometimes it is possible to look at a C++ object and know what its dynamic type is,
      even if it doesn't use C++ polymorphism, because instances of the object and its
      subclasses conform to some other mechanism for being self-describing; for example,
      perhaps there's an enumerated "tag" or "kind" member in the base class that's always
      set to an indication of the correct type. This might be done for performance reasons,
      or to permit most-derived types to be trivially copyable. One of the most widely-known
      examples is in LLVM: https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html
      
      This PR permits pybind11 to be informed of such conventions via a new specializable
      detail::polymorphic_type_hook<> template, which generalizes the previous logic for
      determining the runtime type of an object based on C++ RTTI. Implementors provide
      a way to map from a base class object to a const std::type_info* for the dynamic
      type; pybind11 then uses this to ensure that casting a Base* to Python creates a
      Python object that knows it's wrapping the appropriate sort of Derived.
      
      There are a number of restrictions with this tag-based static polymorphism support
      compared to pybind11's existing support for built-in C++ polymorphism:
      
      - there is no support for this-pointer adjustment, so only single inheritance is permitted
      - there is no way to make C++ code call new Python-provided subclasses
      - when binding C++ classes that redefine a method in a subclass, the .def() must be
        repeated in the binding for Python to know about the update
      
      But these are not much of an issue in practice in many cases, the impact on the
      complexity of pybind11's innards is minimal and localized, and the support for
      automatic downcasting improves usability a great deal.
      fd9bc8f5