"vscode:/vscode.git/clone" did not exist on "eb0f1cc7bfdb957d9e60f93ea91af9d56e3351a7"
  1. 10 Jun, 2017 1 commit
  2. 07 Jun, 2017 1 commit
  3. 28 May, 2017 1 commit
  4. 25 May, 2017 2 commits
    • Jason Rhinelander's avatar
      Add and use detail::remove_reference_t · 129a7256
      Jason Rhinelander authored
      Adds `remove_reference_t` and converts various `typename
      std::remove_reference<...>::type` to using it.
      129a7256
    • Jason Rhinelander's avatar
      Add PYBIND11_EXPAND_SIDE_EFFECTS macro · 926e2cf3
      Jason Rhinelander authored
      This allows calling of functions (typically void) over a parameter
      pack, replacing usage such as:
      
          bool unused[] = { (voidfunc(param_pack_arg), false)..., false };
          (void) unused;
      
      with a much cleaner:
      
          PYBIND11_EXPAND_SIDE_EFFECTS(voidfunc(param_pack_arg));
      926e2cf3
  5. 24 May, 2017 2 commits
    • Jason Rhinelander's avatar
      Allow py::arg().none(false) argument attribute · 4e1e4a58
      Jason Rhinelander authored
      This attribute lets you disable (or explicitly enable) passing None to
      an argument that otherwise would allow it by accepting
      a value by raw pointer or shared_ptr.
      4e1e4a58
    • Jason Rhinelander's avatar
      Add movable cast support to type casters · 813d7e86
      Jason Rhinelander authored
      This commit allows type_casters to allow their local values to be moved
      away, rather than copied, when the type caster instance itself is an rvalue.
      
      This only applies (automatically) to type casters using
      PYBIND11_TYPE_CASTER; the generic type type casters don't own their own
      pointer, and various value casters (e.g. std::string, std::pair,
      arithmetic types) already cast to an rvalue (i.e. they return by value).
      
      This updates various calling code to attempt to get a movable value
      whenever the value is itself coming from a type caster about to be
      destroyed: for example, when constructing an std::pair or various stl.h
      containers.  For types that don't support value moving, the cast_op
      falls back to an lvalue cast.
      
      There wasn't an obvious place to add the tests, so I added them to
      test_copy_move_policies, but also renamed it to drop the _policies as it
      now tests more than just policies.
      813d7e86
  6. 22 May, 2017 3 commits
    • Bruce Merry's avatar
      Support pointers to member functions in def_buffer. · fe0cf8b7
      Bruce Merry authored
      Closes #857, by adding overloads to def_buffer that match pointers to
      member functions and wrap them in lambdas.
      fe0cf8b7
    • Jason Rhinelander's avatar
      Style cleanup of javadoc-style comments · 37b2383a
      Jason Rhinelander authored
      This changes javadoc-style documenting comments from:
      
          /** Text starts here
           * and continues here
           */
      
      to:
      
          /**
           * Test starts here
           * and continues here
           */
      
      which looks a little better, and also matches the javadoc-recommended
      way of writing documenting comments.
      37b2383a
    • Jason Rhinelander's avatar
      Use dynamic cast for shared_from_this holder init · b8ac4383
      Jason Rhinelander authored
      Using a dynamic_cast instead of a static_cast is needed to safely cast
      from a base to a derived type.  The previous static_pointer_cast isn't
      safe, however, when downcasting (and fails to compile when downcasting
      with virtual inheritance).
      
      Switching this to always use a dynamic_pointer_cast shouldn't incur any
      additional overhead when a static_pointer_cast is safe (i.e. when
      upcasting, or self-casting): compilers don't need RTTI checks in those
      cases.
      b8ac4383
  7. 09 May, 2017 3 commits
    • Jason Rhinelander's avatar
      Update PYBIND11_CPP1{4,7} macros for MSVC · ca0e82b7
      Jason Rhinelander authored
      The PYBIND11_CPP14 macro started out as a guard for the compile-time
      path code in `descr.h`, but has since come to mean other things.  This
      means that while the `descr.h` check has just checked the
      `PYBIND11_CPP14` macro, various other places now check `PYBIND11_CPP14
      || _MSC_VER`.  This reverses that by now setting the CPP14 macro when
      MSVC is trying to support C++14, but disabling the `descr.h` C++14 code
      (which still fails under MSVC 2017).
      
      The CPP17 macro also gets enabled when MSVC 2017 is compiling with
      /std:c++latest (the default is /std:c++14), which enables
      `std::optional` and `std::variant` support under MSVC.
      ca0e82b7
    • Jason Rhinelander's avatar
      d15b217f
    • Jason Rhinelander's avatar
      gcc 7 disable warning · 88ebc49b
      Jason Rhinelander authored
      GCC 7 generates (when compiling in C++11/14 mode) warnings such as:
      
          mangled name for ‘pybind11::class_<type_, options>&
          pybind11::class_<type_, options>::def(const char*, Func&&, const Extra&
          ...) [with Func = int (test_exc_sp::C::*)(int) noexcept; Extra = {};
          type_ = test_exc_sp::C; options = {}]’ will change in C++17 because the
          exception specification is part of a function type [-Wnoexcept-type]
      
      There's nothing we can actually do in the code to avoid this, so just
      disable the warning.
      88ebc49b
  8. 07 May, 2017 1 commit
  9. 29 Apr, 2017 1 commit
    • Wenzel Jakob's avatar
      enum_: fix implicit conversion on Python 2.7 · e6fd2cd5
      Wenzel Jakob authored
      Enumerations on Python 2.7 were not always implicitly converted to
      integers (depending on the target size). This patch adds a __long__
      conversion function (only enabled on 2.7) which fixes this issue.
      
      The attached test case fails without this patch.
      e6fd2cd5
  10. 28 Apr, 2017 1 commit
    • Jason Rhinelander's avatar
      Don't let PyInstanceMethod hide itself · 0a90b2db
      Jason Rhinelander authored
      Python 3's `PyInstanceMethod_Type` hides itself via its `tp_descr_get`,
      which prevents aliasing methods via `cls.attr("m2") = cls.attr("m1")`:
      instead the `tp_descr_get` returns a plain function, when called on a
      class, or a `PyMethod`, when called on an instance.  Override that
      behaviour for pybind11 types with a special bypass for
      `PyInstanceMethod_Types`.
      0a90b2db
  11. 27 Apr, 2017 1 commit
    • Jason Rhinelander's avatar
      Track base class pointers of instances · 1f8a100d
      Jason Rhinelander authored
      This commits adds base class pointers of offset base classes (i.e. due
      to multiple inheritance) to `registered_instances` so that if such a
      pointer is returned we properly recognize it as an existing instance.
      
      Without this, returning a base class pointer will cast to the existing
      instance if the pointer happens to coincide with the instance pointer,
      but constructs a new instance (quite possibly with a segfault, if
      ownership is applied) for unequal base class pointers due to multiple
      inheritance.
      1f8a100d
  12. 18 Apr, 2017 1 commit
    • Jason Rhinelander's avatar
      Don't allow mixed static/non-static overloads · d355f2fc
      Jason Rhinelander authored
      We currently fail at runtime when trying to call a method that is
      overloaded with both static and non-static methods.  This is something
      python won't allow: the object is either a function or an instance, and
      can't be both.
      d355f2fc
  13. 02 Apr, 2017 2 commits
  14. 30 Mar, 2017 1 commit
  15. 22 Mar, 2017 2 commits
  16. 19 Mar, 2017 1 commit
    • Jason Rhinelander's avatar
      Error message wording tweak · 0f5ec0a8
      Jason Rhinelander authored
      py::arg() doesn't only specify named arguments anymore, so the error
      message was misleading (e.g. when using `py::arg().noconvert()` and
      forgetting `py::arg()` for a second positional argument).
      0f5ec0a8
  17. 18 Mar, 2017 1 commit
  18. 17 Mar, 2017 1 commit
    • Jason Rhinelander's avatar
      Fail to compile with MI via class_ ctor parameters · b961626c
      Jason Rhinelander authored
      We can't support this for classes from imported modules (which is the
      primary purpose of a ctor argument base class) because we *have* to
      have both parent and derived to properly extract a multiple-inheritance
      base class pointer from a derived class pointer.
      
      We could support this for actual `class_<Base, ...> instances, but since
      in that case the `Base` is already present in the code, it seems more
      consistent to simply always require MI to go via template options.
      b961626c
  19. 13 Mar, 2017 1 commit
  20. 12 Mar, 2017 1 commit
    • Jason Rhinelander's avatar
      Add MSVC 2017 cpp_function ICE workaround · 2d965d43
      Jason Rhinelander authored
      The `decltype(...)` in the template parameter that gives us SFINAE
      matching for a lambda makes MSVC 2017 ICE; this works around if by
      changing the test to an explicit not-a-function-or-pointer test, which
      seems to work everywhere.
      2d965d43
  21. 08 Mar, 2017 1 commit
    • Jason Rhinelander's avatar
      Fix extra docstring newlines under `options.disable_function_signatures()` · 10d13048
      Jason Rhinelander authored
      When using pybind::options to disable function signatures, user-defined
      docstrings only get appended if they exist, but newlines were getting
      appended unconditionally, so the docstring could end up with blank lines
      (depending on which overloads, in particular, provided docstrings).
      
      This commit suppresses the empty lines by only adding newlines for
      overloads when needed.
      10d13048
  22. 04 Mar, 2017 1 commit
  23. 03 Mar, 2017 1 commit
  24. 26 Feb, 2017 1 commit
  25. 24 Feb, 2017 3 commits
    • Jason Rhinelander's avatar
      Add an ability to avoid forcing rvp::move · 546f6fce
      Jason Rhinelander authored
      Eigen::Ref objects, when returned, are almost always returned as
      rvalues; what's important is the data they reference, not the outer
      shell, and so we want to be able to use `::copy`,
      `::reference_internal`, etc. to refer to the data the Eigen::Ref
      references (in the following commits), rather than the Eigen::Ref
      instance itself.
      
      This moves the policy override into a struct so that code that wants to
      avoid it (or wants to provide some other Return-type-conditional
      override) can create a specialization of
      return_value_policy_override<Return> in order to override the override.
      
      This lets an Eigen::Ref-returning function be bound with `rvp::copy`,
      for example, to specify that the data should be copied into a new numpy
      array rather than referenced, or `rvp::reference_internal` to indicate
      that it should be referenced, but a keep-alive used (actually, we used
      the array's `base` rather than a py::keep_alive in such a case, but it
      accomplishes the same thing).
      546f6fce
    • Jason Rhinelander's avatar
      Show kwargs in failed method invocation · 231e1678
      Jason Rhinelander authored
      With the previous commit, output can be very confusing because you only
      see positional arguments in the "invoked with" line, but you can have a
      failure from kwargs as well (in particular, when a value is invalidly
      specified via both via positional and kwargs).  This commits adds
      kwargs to the output, and updates the associated tests to match.
      231e1678
    • Jason Rhinelander's avatar
      Make bad kwarg arguments try next overload · caa1379e
      Jason Rhinelander authored
      Fixes #688.
      
      My (commented) assumption that such an error is "highly likely to be a
      caller mistake" was proven false by #688.
      caa1379e
  26. 23 Feb, 2017 3 commits
    • Dean Moldovan's avatar
      Enable static properties (py::metaclass) by default · dd01665e
      Dean Moldovan authored
      Now that only one shared metaclass is ever allocated, it's extremely
      cheap to enable it for all pybind11 types.
      
      * Deprecate the default py::metaclass() since it's not needed anymore.
      * Allow users to specify a custom metaclass via py::metaclass(handle).
      dd01665e
    • Dean Moldovan's avatar
      Make all classes with the same instance size derive from a common base · 08cbe8df
      Dean Moldovan authored
      In order to fully satisfy Python's inheritance type layout requirements,
      all types should have a common 'solid' base. A solid base is one which
      has the same instance size as the derived type (not counting the space
      required for the optional `dict_ptr` and `weakrefs_ptr`). Thus, `object`
      does not qualify as a solid base for pybind11 types and this can lead to
      issues with multiple inheritance.
      
      To get around this, new base types are created: one per unique instance
      size. There is going to be very few of these bases. They ensure Python's
      MRO checks will pass when multiple bases are involved.
      08cbe8df
    • Dean Moldovan's avatar
      Reimplement static properties by extending PyProperty_Type · c91f8bd6
      Dean Moldovan authored
      Instead of creating a new unique metaclass for each type, the builtin
      `property` type is subclassed to support static properties. The new
      setter/getters always pass types instead of instances in their `self`
      argument. A metaclass is still required to support this behavior, but
      it doesn't store any data anymore, so a new one doesn't need to be
      created for each class. There is now only one common metaclass which
      is shared by all pybind11 types.
      c91f8bd6
  27. 17 Feb, 2017 1 commit
    • Jason Rhinelander's avatar
      Revert noexcept deduction in favour of better SFINAE on lambda functions (#677) · 1d7998e3
      Jason Rhinelander authored
      noexcept deduction, added in PR #555, doesn't work with clang's
      -std=c++1z; and while it works with g++, it isn't entirely clear to me
      that it is required to work in C++17.
      
      What should work, however, is that C++17 allows implicit conversion of a
      `noexcept(true)` function pointer to a `noexcept(false)` (i.e.  default,
      noexcept-not-specified) function pointer.  That was breaking in pybind11
      because the cpp_function template used for lambdas provided a better
      match (i.e. without requiring an implicit conversion), but it then
      failed.
      
      This commit takes a different approach of using SFINAE on the lambda
      function to prevent it from matching a non-lambda object, which then
      gets implicit conversion from a `noexcept` function pointer to a
      `noexcept(false)` function pointer.  This much nicer solution also gets
      rid of the C++17 NOEXCEPT macros, and works in both clang and g++.
      1d7998e3
  28. 08 Feb, 2017 1 commit
    • Matthew Woehlke's avatar
      Avoid C-style const casts (#659) · e15fa9f9
      Matthew Woehlke authored
      * Avoid C-style const casts
      
      Replace C-style casts that discard `const` with `const_cast` (and, where
      necessary, `reinterpret_cast` as well).
      
      * Warn about C-style const-discarding casts
      
      Change pybind11_enable_warnings to also enable `-Wcast-qual` (warn if a
      C-style cast discards `const`) by default. The previous commit should
      have gotten rid of all of these (at least, all the ones that tripped in
      my build, which included the tests), and this should discourage more
      from newly appearing.
      e15fa9f9