1. 03 Nov, 2016 6 commits
  2. 01 Nov, 2016 3 commits
    • 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. 27 Oct, 2016 2 commits
  4. 25 Oct, 2016 2 commits
    • Wenzel Jakob's avatar
      Merge pull request #465 from jagerman/prevent-object-overwriting · a6f85eb9
      Wenzel Jakob authored
      Prevent overwriting previous declarations
      a6f85eb9
    • Jason Rhinelander's avatar
      Prevent overwriting previous declarations · 6873c202
      Jason Rhinelander authored
      Currently pybind11 doesn't check when you define a new object (e.g. a
      class, function, or exception) that overwrites an existing one.  If the
      thing being overwritten is a class, this leads to a segfault (because
      pybind still thinks the type is defined, even though Python no longer
      has the type).  In other cases this is harmless (e.g. replacing a
      function with an exception), but even in that case it's most likely a
      bug.
      
      This code doesn't prevent you from actively doing something harmful,
      like deliberately overwriting a previous definition, but detects
      overwriting with a run-time error if it occurs in the standard
      class/function/exception/def registration interfaces.
      
      All of the additions are in non-template code; the result is actually a
      tiny decrease in .so size compared to master without the new test code
      (977304 to 977272 bytes), and about 4K higher with the new tests.
      6873c202
  5. 24 Oct, 2016 3 commits
  6. 23 Oct, 2016 1 commit
  7. 22 Oct, 2016 8 commits
  8. 21 Oct, 2016 1 commit
  9. 20 Oct, 2016 14 commits