1. 28 Aug, 2018 1 commit
  2. 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
  3. 17 Jul, 2018 4 commits
    • 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
  4. 24 Jun, 2018 4 commits
  5. 21 Jun, 2018 2 commits
  6. 15 Jun, 2018 1 commit
    • Antony Lee's avatar
      Properly report exceptions thrown during module initialization. · 58e551cc
      Antony Lee authored
      If an exception is thrown during module initialization, the
      error_already_set destructor will try to call `get_internals()` *after*
      setting Python's error indicator, resulting in a `SystemError: ...
      returned with an error set`.
      
      Fix that by temporarily stashing away the error indicator in the
      destructor.
      58e551cc
  7. 24 May, 2018 1 commit
  8. 18 May, 2018 1 commit
  9. 07 May, 2018 1 commit
  10. 06 May, 2018 3 commits
  11. 29 Apr, 2018 2 commits
  12. 24 Apr, 2018 1 commit
  13. 22 Apr, 2018 2 commits
    • Wenzel Jakob's avatar
      Minor fix for MSVC warning CS4459 (#1374) · ed670055
      Wenzel Jakob authored
      When using pybind11 to bind enums on MSVC and warnings (/W4) enabled,
      the following warning pollutes builds. This fix renames one of the
      occurrences.
      
      pybind11\include\pybind11\pybind11.h(1398): warning C4459: declaration of 'self' hides global declaration
      pybind11\include\pybind11\operators.h(41): note: see declaration of 'pybind11::detail::self'
      ed670055
    • Henry Schreiner's avatar
      Fix pip issues on AppVeyor CI (#1369) · ffd56ebe
      Henry Schreiner authored
      ffd56ebe
  14. 16 Apr, 2018 1 commit
  15. 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
  16. 09 Apr, 2018 1 commit
  17. 07 Apr, 2018 1 commit
    • Boris Staletic's avatar
      Implement an enum_ property "name" · 289e5d9c
      Boris Staletic authored
      The property returns the enum_ value as a string.
      For example:
      
      >>> import module
      >>> module.enum.VALUE
      enum.VALUE
      >>> str(module.enum.VALUE)
      'enum.VALUE'
      >>> module.enum.VALUE.name
      'VALUE'
      
      This is actually the equivalent of Boost.Python "name" property.
      289e5d9c
  18. 05 Apr, 2018 1 commit
    • Jason Rhinelander's avatar
      Add workaround for clang 3.3/3.4 · 6862cb9b
      Jason Rhinelander authored
      As reported in #1349, clang before 3.5 can segfault on a function-local
      variable referenced inside a lambda.  This moves the function-local
      static into a separate function that the lambda can invoke to avoid the
      issue.
      
      Fixes #1349
      6862cb9b
  19. 03 Apr, 2018 2 commits
  20. 11 Mar, 2018 1 commit
    • Jason Rhinelander's avatar
      Reimplement version check and combine init macros · 6d0b4708
      Jason Rhinelander authored
      This reimplements the version check to avoid sscanf (which has
      reportedly started throwing warnings under MSVC, even when used
      perfectly safely -- #1314).  It also extracts the mostly duplicated
      parts of PYBIND11_MODULE/PYBIND11_PLUGIN into separate macros.
      6d0b4708
  21. 10 Mar, 2018 4 commits
    • Jason Rhinelander's avatar
      9f41c8ea
    • Jason Rhinelander's avatar
      Improve macro type handling for types with commas · e88656ab
      Jason Rhinelander authored
      - PYBIND11_MAKE_OPAQUE now takes ... rather than a single argument and
        expands it with __VA_ARGS__; this lets templated, comma-containing
        types get through correctly.
      - Adds a new macro PYBIND11_TYPE() that lets you pass the type into a
        macro as a single argument, such as:
      
            PYBIND11_OVERLOAD(PYBIND11_TYPE(R<1,2>), PYBIND11_TYPE(C<3,4>), func)
      
        Unfortunately this only works for one macro call: to forward the
        argument on to the next macro call (without the processor breaking it
        up again) requires also adding the PYBIND11_TYPE(...) to type macro
        arguments in the PYBIND11_OVERLOAD_... macro chain.
      - updated the documentation with these two changes, and use them at a couple
        places in the test suite to test that they work.
      e88656ab
    • Marc Schlaich's avatar
      Correct VS version in FAQ · ab003dbd
      Marc Schlaich authored
      ab003dbd
    • Jason Rhinelander's avatar
      Fix for Python3 via brew · 1ddfacba
      Jason Rhinelander authored
      Apparently with homebrew the correct package for python3 is now just
      `python`; python 2 was relegated to 'python@2', and `python3` is an
      alias for `python` (which needs to be upgraded rather than installed).
      1ddfacba
  22. 28 Feb, 2018 2 commits
  23. 18 Feb, 2018 1 commit
  24. 07 Feb, 2018 1 commit