- 03 Nov, 2016 6 commits
-
-
Ivan Smirnov authored
(avoid code bloat if possible)
-
Ivan Smirnov authored
-
Ivan Smirnov authored
NumPy internals are stored under "_numpy_internals" key.
-
Ivan Smirnov authored
-
Ivan Smirnov authored
-
Wenzel Jakob authored
Overriding field names when binding structured dtypes
-
- 01 Nov, 2016 3 commits
-
-
Ivan Smirnov authored
-
Ivan Smirnov authored
PYBIND11_NUMPY_DTYPE_EX(Type, F1, "N1", F2, "N2", ...)
-
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)`.
-
- 27 Oct, 2016 2 commits
-
-
Wenzel Jakob authored
-
Wenzel Jakob authored
The current integer caster was unnecessarily strict and rejected various kinds of NumPy integer types when calling C++ functions expecting normal integers. This relaxes the current behavior.
-
- 25 Oct, 2016 2 commits
-
-
Wenzel Jakob authored
Prevent overwriting previous declarations
-
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.
-
- 24 Oct, 2016 3 commits
-
-
Wenzel Jakob authored
NumPy scalars to ctypes conversion support
-
Ivan Smirnov authored
This reduces direct access to internals.registered_types_cpp to just a few places.
-
Wenzel Jakob authored
-
- 23 Oct, 2016 1 commit
-
-
Ivan Smirnov authored
This avoid a hashmap lookup since the pointer to the list of direct converters is now cached in the typeinfo.
-
- 22 Oct, 2016 8 commits
-
-
Wenzel Jakob authored
-
Wenzel Jakob authored
Bugfix: bad delete if no copy ctor
-
Ivan Smirnov authored
-
Ivan Smirnov authored
-
Ivan Smirnov authored
-
Ivan Smirnov authored
-
Jason Rhinelander authored
* Remove obsolete example reference * Make example fully-working (except for #includes) Fixes #456.
-
Wenzel Jakob authored
Fix def_property and related functions
-
- 21 Oct, 2016 1 commit
-
-
Dean Moldovan authored
Making `cppfunction` explicit broke `def_property` and friends. The added tests would not compile without an implicit `cppfunction`.
-
- 20 Oct, 2016 14 commits
-
-
Ben North authored
Without the previous commit, this test generates a core dump.
-
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. -
Wenzel Jakob authored
Support std::shared_ptr holder type out of the box
-
Ivan Smirnov authored
-
Ivan Smirnov authored
-
Wenzel Jakob authored
Reorganize documentation
-
Ivan Smirnov authored
-
Ivan Smirnov authored
-
Ivan Smirnov authored
-
Ivan Smirnov authored
-
Ivan Smirnov authored
-
Dean Moldovan authored
With this there is no more need for manual user declarations like `PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>)`. Existing ones will still compile without error -- they will just be ignored silently. Resolves #446.
-
Dean Moldovan authored
-
Dean Moldovan authored
-