1. Nov 03, 2016
  2. Nov 01, 2016
    • Ivan Smirnov's avatar
      abd3429c
    • Ivan Smirnov's avatar
      Add dtype binding macro that allows setting names · e8b50360
      Ivan Smirnov authored
      PYBIND11_NUMPY_DTYPE_EX(Type, F1, "N1", F2, "N2", ...)
      e8b50360
    • Dean Moldovan's avatar
      Make reference(_internal) the default return value policy for properties (#473) · 03f627eb
      Dean Moldovan authored
      * Make reference(_internal) the default return value policy for properties
      
      Before this, all `def_property*` functions used `automatic` as their
      default return value policy. This commit makes it so that:
      
       * Non-static properties use `reference_interal` by default, thus
         matching `def_readonly` and `def_readwrite`.
      
       * Static properties use `reference` by default, thus matching
         `def_readonly_static` and `def_readwrite_static`.
      
      In case `cpp_function` is passed to any `def_property*`, its policy will
      be used instead of any defaults. User-defined arguments in `extras`
      still have top priority and will override both the default policies and
      the ones from `cpp_function`.
      
      Resolves #436.
      
      * Almost always use return_value_policy::move for rvalues
      
      For functions which return rvalues or rvalue references, the only viable
      return value policies are `copy` and `move`. `reference(_internal)` and
      `take_ownership` would take the address of a temporary which is always
      an error.
      
      This commit prevents possible user errors by overriding the bad rvalue
      policies with `move`. Besides `move`, only `copy` is allowed, and only
      if it's explicitly selected by the user.
      
      This is also a necessary safety feature to support the new default
      return value policies for properties: `reference(_internal)`.
      03f627eb
  3. Oct 28, 2016
  4. Oct 25, 2016
  5. Oct 23, 2016
  6. Oct 22, 2016
  7. Oct 21, 2016
    • Ben North's avatar
      Test uncopyable static member · bbe45082
      Ben North authored
      Without the previous commit, this test generates a core dump.
      bbe45082
    • Ben North's avatar
      Fix wrapper's 'value' and 'owned' if ctor missing · 24a2054d
      Ben North authored
      type_caster_generic::cast(): The values of
      
          wrapper->value
          wrapper->owned
      
      are incorrect in the case that a return value policy of 'copy' is
      requested but there is no copy-constructor.  (Similarly 'move'.)  In
      particular, if the source object is a static instance, the destructor of
      the 'object' 'inst' leads to class_::dealloc() which incorrectly
      attempts to 'delete' the static instance.
      
      This commit re-arranges the code to be clearer as to what the values of
      'value' and 'owned' should be in the various cases.  Behaviour is
      different to previous code only in two situations:
      
      policy = copy but no copy-ctor: Old code leaves 'value = src, owned =
      true', which leads to trouble.  New code leaves 'value = nullptr, owned
      = false', which is correct.
      
      policy = move but no move- or copy-ctor: old code leaves 'value = src,
      owned = true', which leads to trouble.  New code leaves 'value =
      nullptr, owned = false', which is correct.
      24a2054d
    • Wenzel Jakob's avatar
      Merge pull request #454 from dean0x7d/shared_ptr · 77898af0
      Wenzel Jakob authored
      Support std::shared_ptr holder type out of the box
      77898af0
  8. Oct 20, 2016