Commit Graph

49 Commits

Author SHA1 Message Date
Wenzel Jakob
ed52f4664c updated changelog 2016-12-26 13:54:50 +01:00
Wenzel Jakob
3c79671112 a few more minor v2.0.0-rc1 related changes 2016-12-23 16:19:36 +01:00
Wenzel Jakob
d3549d6027 added changelog for v2.0.0-rc1 2016-12-23 16:01:19 +01:00
Dean Moldovan
e18bc02fc9 Add default and converting constructors for all concrete Python types
* Deprecate the `py::object::str()` member function since `py::str(obj)`
  is now equivalent and preferred

* Make `py::repr()` a free function

* Make sure obj.cast<T>() works as expected when T is a Python type

`obj.cast<T>()` should be the same as `T(obj)`, i.e. it should convert
the given object to a different Python type. However, `obj.cast<T>()`
usually calls `type_caster::load()` which only checks the type without
doing any actual conversion. That causes a very unexpected `cast_error`.
This commit makes it so that `obj.cast<T>()` and `T(obj)` are the same
when T is a Python type.

* Simplify pytypes converting constructor implementation

It's not necessary to maintain a full set of converting constructors
and assignment operators + const& and &&. A single converting const&
constructor will work and there is no impact on binary size. On the
other hand, the conversion functions can be significantly simplified.
2016-11-17 08:55:42 +01:00
Ivan Smirnov
44a69f78cf std::experimental::optional (#475)
* Add type caster for std::experimental::optional

* Add tests for std::experimental::optional

* Support both <optional> / <experimental/optional>

* Mention std{::experimental,}::optional in the docs
2016-11-03 13:42:46 +01:00
Dean Moldovan
03f627ebb1 Make reference(_internal) the default return value policy for properties (#473)
* 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)`.
2016-11-01 11:44:57 +01:00
Dean Moldovan
5d28dd1194 Support std::shared_ptr holder type out of the box
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.
2016-10-20 16:19:58 +02:00
Dean Moldovan
242b146a51 Extend attribute and item accessor interface using object_api 2016-09-23 02:00:01 +02:00
Dean Moldovan
625bd48a91 Document calling function with keyword arguments from C++ 2016-09-06 16:41:50 +02:00
Ivan Smirnov
606160ed68 Update the changelog re: generalized iterators 2016-08-24 23:32:13 +01:00
Ivan Smirnov
6715736936 Add handle::repr() method 2016-08-14 13:43:31 +01:00
Ivan Smirnov
bccbc10a65 Update changelog and authors 2016-08-13 21:17:26 +01:00
Wenzel Jakob
a720a6046e updated changelog with v1.8.1, updated release instructions 2016-07-12 18:03:17 +02:00
Wenzel Jakob
c47d498c35 fix rare GC issue during type creation (fixes #277) 2016-07-11 23:41:15 +02:00
Wenzel Jakob
58ec1caa9b updated README and changelog 2016-07-11 23:39:39 +02:00
Wenzel Jakob
e6b2f75949 updated changelog 2016-07-10 10:54:46 +02:00
Wenzel Jakob
f88af0c127 clarification on static properties (fixes #248) 2016-06-22 13:52:31 +02:00
Wenzel Jakob
f950215046 note about semver policy 2016-06-14 15:02:07 +02:00
Wenzel Jakob
1cbe7ef2ac changelog update 2016-06-14 14:55:10 +02:00
Wenzel Jakob
38d8b8cfe2 don't allow registering a class twice (fixes #218) 2016-05-31 09:53:28 +02:00
Wenzel Jakob
86d825f330 Redesigned virtual call mechanism and user-facing syntax (breaking change!)
Sergey Lyskov pointed out that the trampoline mechanism used to override
virtual methods from within Python caused unnecessary overheads when
instantiating the original (i.e. non-extended) class.

This commit removes this inefficiency, but some syntax changes were
needed to achieve this. Projects using this features will need to make a
few changes:

In particular, the example below shows the old syntax to instantiate a
class with a trampoline:

class_<TrampolineClass>("MyClass")
    .alias<MyClass>()
    ....

This is what should be used now:

class_<MyClass, std::unique_ptr<MyClass, TrampolineClass>("MyClass")
    ....

Importantly, the trampoline class is now specified as the *third*
argument to the class_ template, and the alias<..>() call is gone. The
second argument with the unique pointer is simply the default holder
type used by pybind11.
2016-05-26 13:36:24 +02:00
Wenzel Jakob
3f200fab22 don't implicitly convert doubles to ints 2016-05-17 15:35:29 +02:00
Wenzel Jakob
9e0a0568fe transparent conversion of dense and sparse Eigen types 2016-05-05 21:44:29 +02:00
Wenzel Jakob
163ac2ef53 changelog updates 2016-05-03 14:16:18 +02:00
Wenzel Jakob
c4d7ccd8b0 started working on v1.8 2016-04-30 22:00:44 +02:00
Wenzel Jakob
e70b2abb6d preparing for v1.7 release 2016-04-30 22:00:24 +02:00
Wenzel Jakob
dd7ec34d50 documentation updates 2016-04-29 10:06:24 +02:00
Wenzel Jakob
e84f557edf documentation improvements 2016-04-26 23:48:55 +02:00
Wenzel Jakob
1ac22e35e3 changelog updates 2016-04-25 23:25:40 +02:00
Wenzel Jakob
bb79d7bdc0 preparing for version 1.5 release 2016-04-21 12:23:20 +02:00
Wenzel Jakob
dbe43ffcce completed implicit type casters for reference_wrapper 2016-04-21 12:21:14 +02:00
Wenzel Jakob
c79dbe425d FAQ improvements 2016-04-18 10:53:38 +02:00
Wenzel Jakob
b2b44a9af8 fix for virtual dispatch on newly created threads 2016-04-15 17:59:53 +02:00
Wenzel Jakob
b282595bba convenience wrapper for constructing iterators (fixes #142) 2016-04-14 00:23:37 +02:00
Wenzel Jakob
d7efa4ff7b return best representation of polymorphic types (fixes #105) 2016-04-13 13:51:33 +02:00
Wenzel Jakob
1c329aab5a pickling support (fixes #144) 2016-04-13 02:58:56 +02:00
Wenzel Jakob
2c5d560640 changelog update 2016-04-11 18:46:11 +02:00
Wenzel Jakob
33c2a0494f minor documentation update 2016-04-07 09:06:49 +02:00
Wenzel Jakob
0e6ca5916e version 1.4 2016-04-07 08:49:37 +02:00
Wenzel Jakob
3411673fbf updated changelog 2016-04-06 17:55:41 +02:00
Wenzel Jakob
4e455dde0b updated changelog, added build directory to gitignore file 2016-03-09 16:50:40 +01:00
Wenzel Jakob
81dfd2c51f Working type casters for wide strings and wide characters 2016-03-08 20:48:07 +01:00
Wenzel Jakob
d2385e8fc6 ready for version 1.3 2016-03-08 18:09:50 +01:00
Wenzel Jakob
cf2b87aa5e changelog update 2016-02-22 17:32:44 +01:00
Wenzel Jakob
8ed2808239 pybind11, version 1.2 2016-02-07 17:32:37 +01:00
Wenzel Jakob
cd4e6ae3f0 updated changelog 2016-01-29 11:48:40 +01:00
Wenzel Jakob
61587164ed example on manually vectorizing numpy code (closes #27) 2016-01-18 22:38:52 +01:00
Wenzel Jakob
48548ea4a5 general cleanup of the codebase
- new pybind11::base<> attribute to indicate a subclass relationship
- unified infrastructure for parsing variadic arguments in class_ and cpp_function
- use 'handle' and 'object' more consistently everywhere
2016-01-17 22:31:15 +01:00
Wenzel Jakob
1ae77fe4d3 added a changelog file and version defines 2016-01-17 22:31:15 +01:00