Commit Graph

392 Commits

Author SHA1 Message Date
Wenzel Jakob
e33ef9c20d v2.0.0 release 2017-01-01 13:56:37 +01:00
Wenzel Jakob
401008163a updated release instructions 2016-12-29 23:44:48 +01:00
Michael König
f331843b39 Make non-ancient version of GCC explicit in documentation (it means 4.8+) (#575) 2016-12-28 12:10:11 +01:00
Wenzel Jakob
f3de2d5521 reference binder project from documentation 2016-12-26 13:54:50 +01:00
Wenzel Jakob
1805c3489f updated LOC values in README.md and intro.rst 2016-12-26 13:54:50 +01:00
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
Jason Rhinelander
05920e363e Change compilation/test target back to check (#566) 2016-12-19 17:33:02 +01:00
Dean Moldovan
71e8a7962c Rename target from pybind11::pybind11 to pybind11::module
Makes room for an eventual pybind11::embedded target.
2016-12-19 16:34:48 +01:00
Dean Moldovan
0cbec5c96e Add new options and docs for pybind11_add_module
See the documentation for a description of the options.
2016-12-19 16:34:48 +01:00
Wenzel Jakob
003a9eba59 fixed pypy minimum version 2016-12-18 17:08:13 +01:00
Wenzel Jakob
1d1f81b278 WIP: PyPy support (#527)
This commit includes modifications that are needed to get pybind11 to work with PyPy. The full test suite compiles and runs except for a last few functions that are commented out (due to problems in PyPy that were reported on the PyPy bugtracker).

Two somewhat intrusive changes were needed to make it possible: two new tags ``py::buffer_protocol()`` and ``py::metaclass()`` must now be specified to the ``class_`` constructor if the class uses the buffer protocol and/or requires a metaclass (e.g. for static properties).

Note that this is only for the PyPy version based on Python 2.7 for now. When the PyPy 3.x has caught up in terms of cpyext compliance, a PyPy 3.x patch will follow.
2016-12-16 15:00:46 +01:00
Wenzel Jakob
2029171211 always_construct_holder feature to support intrusively reference-counted types (#561)
* always_construct_holder feature to support intrusively reference-counted types

* added testcase
2016-12-15 23:44:23 +01:00
Lori A. Burns
f4b81b36bf reflow some docs paragraphs 2016-12-13 21:44:19 +01:00
Lori A. Burns
5cafc99884 add CMake exported interface library and Config detection file 2016-12-13 21:44:19 +01:00
Jason Rhinelander
3f1ff3f4d1 Adds automatic casting on assignment of non-pyobject types (#551)
This adds automatic casting when assigning to python types like dict,
list, and attributes.  Instead of:

    dict["key"] = py::cast(val);
    m.attr("foo") = py::cast(true);
    list.append(py::cast(42));

you can now simply write:

    dict["key"] = val;
    m.attr("foo") = true;
    list.append(42);

Casts needing extra parameters (e.g. for a non-default rvp) still
require the py::cast() call. set::add() is also supported.

All usage is channeled through a SFINAE implementation which either just returns or casts. 

Combined non-converting handle and autocasting template methods via a
helper method that either just returns (handle) or casts (C++ type).
2016-12-12 23:42:52 +01:00
Wenzel Jakob
8fadade225 add valarray to documentation, update docutils on travis 2016-12-09 16:08:16 +01:00
Dean Moldovan
4e959c9af4 Add syntax sugar for resolving overloaded functions (#541) 2016-12-08 11:07:52 +01:00
Dean Moldovan
ab90ec6ce9 Allow references to objects held by smart pointers (#533) 2016-12-07 02:36:44 +01:00
Wenzel Jakob
405f6d1dfd make arithmetic operators of enum_ optional (#508)
Following commit 90d278, the object code generated by the python
bindings of nanogui (github.com/wjakob/nanogui) went up by a whopping
12%. It turns out that that project has quite a few enums where we don't
really care about arithmetic operators.

This commit thus partially reverts the effects of #503 by introducing
an additional attribute py::arithmetic() that must be specified if the
arithmetic operators are desired.
2016-11-17 23:24:47 +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
Wenzel Jakob
2fb5f1d0c3 added message about recursion limits 2016-11-16 17:37:10 +01:00
Alexander Stukowski
9a110e6da8 Provide more control over automatic generation of docstrings (#486)
Added the docstring_options class, which gives global control over the generation of docstrings and function signatures.
2016-11-15 12:38:05 +01:00
Wenzel Jakob
45e6e6f6eb add note about custom type casters (fixes #480) 2016-11-04 11:06:22 +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
Ivan Smirnov
f95fda0eb2 Add docs re: shared data API 2016-11-03 09:35:05 +00: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
Wenzel Jakob
6ba98650e2 a bit of work on the new documentation structure 2016-10-24 23:48:20 +02:00
Jason Rhinelander
fb7c9fd326 Remove obsolete example reference (#457)
* Remove obsolete example reference
* Make example fully-working (except for #includes)

Fixes #456.
2016-10-22 18:54:33 +02: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
f0b0df58a9 Directly compare 3 ways of moving data between C++ and Python 2016-10-20 15:21:34 +02:00
Dean Moldovan
67b52d808e Reorganize documentation 2016-10-20 15:21:34 +02:00
Dean Moldovan
9273af4f92 Document dynamic attributes 2016-10-14 01:16:40 +02:00
Wenzel Jakob
632dee1e11 Merge pull request #356 from TrentHouliston/master
Add in casts for c++11s chrono classes to pythons datetime
2016-09-27 17:58:34 +02:00
Trent Houliston
10a6a90738 Redo documentation to make it easier to read 2016-09-28 01:01:59 +10:00
Dean Moldovan
242b146a51 Extend attribute and item accessor interface using object_api 2016-09-23 02:00:01 +02:00
Jason Rhinelander
20ef62656f Fix minor documentation spelling mistakes 2016-09-21 13:39:02 -04:00
Wenzel Jakob
d4285a6dda ..one more typo 2016-09-21 19:30:23 +02:00
Wenzel Jakob
514371ebec typo fixes (spotted by @TheGhostHuCodes) 2016-09-21 19:29:19 +02:00
Wenzel Jakob
8e5dceb6a6 Multiple inheritance support 2016-09-19 13:45:31 +02:00
Wenzel Jakob
bad589a477 deprecated py::base<>, added a macro for improved readability 2016-09-19 13:43:47 +02:00
Jason Rhinelander
b3794f1087 Added py::register_exception for simple case (#296)
The custom exception handling added in PR #273 is robust, but is overly
complex for declaring the most common simple C++ -> Python exception
mapping that needs only to copy `what()`.  This add a simpler
`py::register_exception<CppExp>(module, "PyExp");` function that greatly
simplifies the common basic case of translation of a simple CppException
into a simple PythonException, while not removing the more advanced
capabilities of defining custom exception handlers.
2016-09-16 08:04:15 +02:00
Trent Houliston
2f597687e7 Changed non system clocks to be time deltas
Allowed durations and non system clocks to be set from floats.
2016-09-13 20:40:28 +10:00
Trent Houliston
352149e892 Refactor the chrono cast functions into chrono.h.
Add unit tests and documentation for the chrono cast.
2016-09-13 19:58:05 +10:00
Jason Rhinelander
7dfb932e70 Update OVERLOAD macros to support ref/ptr return type overloads
This adds a static local variable (in dead code unless actually needed)
in the overload code that is used for storage if the overload is for
some convert-by-value type (such as numeric values or std::string).

This has limitations (as written up in the advanced doc), but is better
than simply not being able to overload reference or pointer methods.
2016-09-11 01:21:53 -04:00
Jason Rhinelander
6eca083e4c Fix doc typo
"trampoline" is doubled in the first sentence.
2016-09-11 01:16:19 -04:00
Wenzel Jakob
1f2e417d8c Merge pull request #403 from jagerman/alias-initialization
Implement py::init_alias<>() constructors
2016-09-10 16:12:19 +09:00
Wenzel Jakob
382484ae56 operators should return NotImplemented given unsupported input (fixes #393) 2016-09-10 15:34:26 +09:00
Jason Rhinelander
ec62d977c4 Implement py::init_alias<>() constructors
This commit adds support for forcing alias type initialization by
defining constructors with `py::init_alias<arg1, arg2>()` instead of
`py::init<arg1, arg2>()`.  Currently py::init<> only results in Alias
initialization if the type is extended in python, or the given
arguments can't be used to construct the base type, but can be used to
construct the alias.  py::init_alias<>, in contrast, always invokes the
constructor of the alias type.

It looks like this was already the intention of
`py::detail::init_alias`, which was forward-declared in
86d825f330, but was apparently never
finished: despite the existance of a .def method accepting it, the
`detail::init_alias` class isn't actually defined anywhere.

This commit completes the feature (or possibly repurposes it), allowing
declaration of classes that will always initialize the trampoline which
is (as I argued in #397) sometimes useful.
2016-09-09 03:04:09 -04:00
Jason Rhinelander
6b52c838d7 Allow passing base types as a template parameter
This allows a slightly cleaner base type specification of:

    py::class_<Type, Base>("Type")

as an alternative to

    py::class_<Type>("Type", py::base<Base>())

As with the other template parameters, the order relative to the holder
or trampoline types doesn't matter.

This also includes a compile-time assertion failure if attempting to
specify more than one base class (but is easily extendible to support
multiple inheritance, someday, by updating the class_selector::set_bases
function to set multiple bases).
2016-09-06 20:34:24 -04:00
Jason Rhinelander
5fffe200e3 Allow arbitrary class_ template option ordering
The current pybind11::class_<Type, Holder, Trampoline> fixed template
ordering results in a requirement to repeat the Holder with its default
value (std::unique_ptr<Type>) argument, which is a little bit annoying:
it needs to be specified not because we want to override the default,
but rather because we need to specify the third argument.

This commit removes this limitation by making the class_ template take
the type name plus a parameter pack of options.  It then extracts the
first valid holder type and the first subclass type for holder_type and
trampoline type_alias, respectively.  (If unfound, both fall back to
their current defaults, `std::unique_ptr<type>` and `type`,
respectively).  If any unmatched template arguments are provided, a
static assertion fails.

What this means is that you can specify or omit the arguments in any
order:

    py::class_<A, PyA> c1(m, "A");
    py::class_<B, PyB, std::shared_ptr<B>> c2(m, "B");
    py::class_<C, std::shared_ptr<C>, PyB> c3(m, "C");

It also allows future class attributes (such as base types in the next
commit) to be passed as class template types rather than needing to use
a py::base<> wrapper.
2016-09-06 12:22:13 -04:00
Dean Moldovan
625bd48a91 Document calling function with keyword arguments from C++ 2016-09-06 16:41:50 +02:00
Wenzel Jakob
6f017cf658 basics.rst: minor table update for Eigen types 2016-09-06 14:13:35 +09:00
Wenzel Jakob
48ce0727e4 added docs for custom type casters (fixes #298) 2016-09-06 14:13:22 +09:00
Wenzel Jakob
fe34241e50 minor doc & style fixes 2016-09-06 13:02:29 +09:00
Sergey Lyskov
7520418e26 Adding bind_map 2016-09-05 17:11:16 -04:00
Wenzel Jakob
70f5a4dc8b minor: added error message to faq 2016-09-05 17:19:18 +09:00
Jason Rhinelander
64830e3333 Doc fix for OVERLOAD*_NAME macros
The documentation says the string-valued python function name goes
after the C++ function, but it actually goes before it.
2016-08-29 16:58:59 -04:00
Wenzel Jakob
5e4e477b8b minor fixes to PR #368 2016-08-28 02:03:15 +02:00
Nickolai Belakovski
6333825350 Added support for exposing classes with private destructors and corresponding documentation 2016-08-27 15:09:15 -07:00
Ivan Smirnov
606160ed68 Update the changelog re: generalized iterators 2016-08-24 23:32:13 +01:00
Wenzel Jakob
faec30c4db Merge pull request #321 from dean0x7d/pytest
Port test suite to pytest
2016-08-22 13:02:27 +02:00
Wenzel Jakob
bf099587cd documentation clarifications (fixes #346) 2016-08-22 12:52:02 +02:00
Dean Moldovan
ec0d38ef25 Update the docs to reflect the new test structure
Test compilation instructions for Windows were changed to use the
`cmake --build` command line invocation which should be easier than
manually setting up using the CMake GUI and Visual Studio.
2016-08-19 13:32:01 +02:00
Wenzel Jakob
192eb88475 ..mention in benchmark docs as well 2016-08-19 09:38:14 +02:00
Wenzel Jakob
68b193e3f2 mention pyrosetta stats 2016-08-19 09:32:58 +02:00
Wenzel Jakob
0b63231bae minor doc touchups 2016-08-18 10:58:21 +02:00
Glen Walker
f45bb585c3 Support keep_alive where nurse may be None
For example keep_alive<0,1>() should work where the return value may sometimes be None. At present a "Could not allocate weak reference!" exception is thrown.
Update documentation to clarify behaviour of keep_alive when nurse is None or does not support weak references.
2016-08-18 09:09:41 +12:00
Dean Moldovan
aebca12bb9 Fix sphinx doc missing code blocks and warnings
The missing empty line after `.. code-block::` resulted in incorrectly
parsed restructuredtext (sphinx warnings) and the code blocks were not
generated in the html output.

The `exclude_patterns` change just silences the orphaned file warning.

[ci skip]
2016-08-16 01:30:58 +02: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
Ivan Smirnov
b65185906d Update the docs to use the new array ctor 2016-08-13 13:28:56 +01:00
Ivan Smirnov
5412a05cf0 Rename PYBIND11_DTYPE to PYBIND11_NUMPY_DTYPE 2016-08-13 12:43:16 +01:00
Ivan Smirnov
5afe9df30a Minor fix in the docs 2016-08-13 12:43:16 +01:00
Ivan Smirnov
223afe37fa Add documentation re: PYBIND11_DTYPE macro 2016-08-13 12:43:16 +01:00
Ivan Smirnov
5e71e17bdf Make changes to format_descriptor backwards-compat
The format strings that are known at compile time are now accessible
via both ::value and ::format(), and format strings for everything
else is accessible via ::format(). This makes it backwards compatible.
2016-08-13 12:43:16 +01:00
Ivan Smirnov
42ad328481 Change format_descriptor::value to a static func 2016-08-13 12:43:16 +01:00
Jason Rhinelander
5aa85be26e Added pybind11::make_key_iterator for map iteration
This allows exposing a dict-like interface to python code, allowing
iteration over keys via:

    for k in custommapping:
        ...

while still allowing iteration over pairs, so that you can also
implement 'dict.items()' functionality which returns a pair iterator,
allowing:

    for k, v in custommapping.items():
        ...

example-sequences-and-iterators is updated with a custom class providing
both types of iteration.
2016-08-11 21:22:05 -04:00
Jason Rhinelander
f2ecd8927e Implement reference_internal with a keep_alive
reference_internal requires an `instance` field to track the returned
reference's parent, but that's just a duplication of what
keep_alive<0,1> does, so use a keep alive to do this to eliminate the
duplication.
2016-08-10 12:08:04 -04:00
Jason Rhinelander
efc2aa7ee7 Removed obsolete documentation about duplicate address problems
It no longer applies since instances are now identified by both address
and type.
2016-08-10 11:38:33 -04:00
Jason Rhinelander
d6c365bcfa virtual + inheritance example: remove multiple inheritance approach
It was already pretty badly intrusive, but it also appears to make MSVC
segfault.  Rather than investigating and fixing it, it's easier to just
remove it.
2016-08-05 18:03:06 -04:00
Jason Rhinelander
0ca96e2915 Added advanced doc section on virtual methods + inheritance
As discussed in #320.

The adds a documentation block that mentions that the trampoline classes
must provide overrides for both the classes' own virtual methods *and*
any inherited virtual methods.  It also provides a templated solution to
avoiding method duplication.

The example includes a third method (only mentioned in the "see also"
section of the documentation addition), using multiple inheritance.
While this approach works, and avoids code generation in deep
hierarchies, it is intrusive by requiring that the wrapped classes use
virtual inheritance, which itself is more instrusive if any of the
virtual base classes need anything other than default constructors.  As
per the discussion in #320, it is kept as an example, but not suggested
in the documentation.
2016-08-05 18:02:37 -04:00
Jason Rhinelander
b68d8fc2c5 *Really* fix enumeration indices 2016-08-04 16:39:30 -04:00
Jason Rhinelander
38d5b4565c Fixed enumeration indices 2016-08-04 16:36:16 -04:00
Jason Rhinelander
9ffb3dda5f Eigen support for special matrix objects
Functions returning specialized Eigen matrices like Eigen::DiagonalMatrix and
Eigen::SelfAdjointView--which inherit from EigenBase but not
DenseBase--isn't currently allowed; such classes are explicitly copyable
into a Matrix (by definition), and so we can support functions that
return them by copying the value into a Matrix then casting that
resulting dense Matrix into a numpy.ndarray.  This commit does exactly
that.
2016-08-04 15:24:41 -04:00
Wenzel Jakob
3764e28475 added note about args/kwargs limitation 2016-08-01 23:34:48 +02:00
Wenzel Jakob
f38f359f96 documentation fix (fixes #290) 2016-07-19 17:48:42 +02:00
Jason Rhinelander
3e2e44f53f Updated advanced.rst example references 2016-07-18 17:03:37 -04:00
Wenzel Jakob
fb6aed2157 return value policy clarifications 2016-07-18 20:29:53 +02: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
3c6ada3a48 Merge pull request #273 from lsst-dm/master
Add support for user defined exception translators
2016-07-11 23:38:21 +02:00
Pim Schellart
5a7d17ff16 Add support for user defined exception translators 2016-07-11 17:33:04 -04:00
Wenzel Jakob
e6b2f75949 updated changelog 2016-07-10 10:54:46 +02:00
Wenzel Jakob
954b7932fe avoid C++ -> Python -> C++ overheads when passing around function objects 2016-07-10 10:44:44 +02:00
Wenzel Jakob
0d3fc3566a complete rewrite of eval/exec patch 2016-07-08 10:52:10 +02:00
Klemens Morgenstern
c6ad2c4993 added exec functions 2016-07-08 10:05:24 +02:00
Wenzel Jakob
3eeea6fa61 docs: point out limitations of implicit conversions 2016-06-30 18:10:28 +02:00
Wenzel Jakob
f53e300fbd doc updates 2016-06-30 14:59:23 +02:00
Wenzel Jakob
09e22b4a17 Merge pull request #255 from nafur/patch-1
Added warning about same-address-optimization
2016-06-30 14:48:29 +02:00
Wenzel Jakob
4626b5a4af updated limitations section 2016-06-30 14:46:11 +02:00
nafur
717df75237 Added warning about same-address-optimization
See https://github.com/pybind/pybind11/issues/254
2016-06-28 18:07:11 +02:00
Wenzel Jakob
37e1f61f54 allow passing a 'return value policy' to handle::operator() 2016-06-22 14:29:13 +02:00
Wenzel Jakob
f88af0c127 clarification on static properties (fixes #248) 2016-06-22 13:52:31 +02:00
Brad Harmon
835fc06ca4 Add callback examples with named parameters 2016-06-16 13:19:15 -05:00
Wenzel Jakob
663513cf23 release process clarifications 2016-06-14 16:08:31 +02:00
Wenzel Jakob
f85c52901e starting to work on release v1.9 2016-06-14 15:24:47 +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
Dean Moldovan
b3eadfa595 Update docs with _a suffix notation for named arguments 2016-06-03 23:52:56 +02:00
Wenzel Jakob
f600c1d899 updated FAQ section on Python detection 2016-06-03 14:47:54 +02:00
Wenzel Jakob
ca8dc08a66 updated pbtest link 2016-06-03 14:24:17 +02:00
Wenzel Jakob
aa79af09f6 updated cmake example link 2016-06-03 12:23:24 +02:00
Wenzel Jakob
9bb97c1b96 docs: added a general note about macro usage 2016-06-03 11:19:50 +02:00
Wenzel Jakob
99279f7107 docs: switched lexer for python console snippets to 'pycon' 2016-06-03 11:19:50 +02:00
Wenzel Jakob
38d8b8cfe2 don't allow registering a class twice (fixes #218) 2016-05-31 09:53:28 +02:00
Wenzel Jakob
1503d2fb50 Merge pull request #207 from dean0x7d/cmake
Simplify CMake build using add_subdirectory
2016-05-29 12:29:36 +02:00
Dean Moldovan
24ddf4b3f1 Update CMake build documentation 2016-05-27 00:11:52 +02:00
Wenzel Jakob
2c76c693f6 minor update to release process 2016-05-26 16:50:15 +02:00
Wenzel Jakob
6e2e0e9821 Merge pull request #214 from yungyuc/yyc-docver
Update document version to the next release 1.8
2016-05-26 16:48:28 +02:00
Yung-Yu Chen
2240ce2adf Update document version to the next release 1.8 2016-05-26 22:32:41 +08: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
1e3be73a52 PYBIND11_OVERLOAD_NAME and PYBIND11_OVERLOAD_PURE_NAME (fixes #205) 2016-05-24 23:42:14 +02:00
Wenzel Jakob
bd986fe57e add comment about macro issues (fixes #203) 2016-05-21 10:48:30 +02:00
Wenzel Jakob
b47a9de035 ability to prevent force casts in numpy arguments 2016-05-19 16:02:09 +02:00
Nils Werner
f7048f25b1 Fixed typo in NumPy example which prevented compilation 2016-05-19 11:17:17 +02:00
Wenzel Jakob
3f200fab22 don't implicitly convert doubles to ints 2016-05-17 15:35:29 +02:00
Wenzel Jakob
a439ccaa0e minor FAQ edits, referenced cppimport project 2016-05-17 10:47:52 +02:00
Sergey Lyskov
a95bde1ea5 Adding documentation for value_error. Fixing various formatting issues. Removing redundant binding for C++ style methods. Adding bindings for iterator and slicing protocol. Extending examples. 2016-05-15 20:46:07 +02:00
Wenzel Jakob
178c8a899d nicer type_caster::load() calling conventions 2016-05-15 20:23:27 +02:00
Wenzel Jakob
ace7b4386e switched to conda-forge, updated release process docs 2016-05-10 13:09:33 +01:00
Wenzel Jakob
9e0a0568fe transparent conversion of dense and sparse Eigen types 2016-05-05 21:44:29 +02:00
Wenzel Jakob
9ac5bc5531 fix captialization issue in CMakeLists.txt 2016-05-05 16:27:13 +02:00
Wenzel Jakob
e762853bba nicer example on instantiating Eigen matrices 2016-05-05 11:07:54 +02:00
Wenzel Jakob
f1032df891 only do numpy contiguous C/Fortran array conversion when explicitly requested 2016-05-05 10:00:00 +02:00
Wenzel Jakob
876eeab4ca redesigned format_descriptor<> and npy_format_descriptor<>
This somewhat heavyweight solution will avoid size_t/long long/long/int
mismatches on various platforms once and for all. The previous template
overloads could e.g. not handle size_t on Darwin.

One gotcha: the 'format_descriptor<T>::value()' syntax changed to just
'format_descriptor<T>::value'
2016-05-04 22:36:57 +02:00
Wenzel Jakob
c62360d994 minor FAQ updates 2016-05-03 14:32:47 +02:00
Wenzel Jakob
163ac2ef53 changelog updates 2016-05-03 14:16:18 +02:00
Wenzel Jakob
bdd11030c2 minor cmake improvements on windows 2016-05-01 13:11:54 +02:00
Wenzel Jakob
8e93df825e minor clarification regarding keep_alive; fixed some typos 2016-05-01 02:36:58 +02:00
Wenzel Jakob
81e0975b82 clarified pickle version requirements (fixes #186) 2016-04-30 23:16:31 +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
06f56ee1e9 opaque type redesign 2016-04-28 17:49:46 +02:00
Wenzel Jakob
f64feaf3e4 documentation improvements 2016-04-28 15:32:07 +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
f7b5874ca3 new move value policy 2016-04-25 23:04:27 +02:00
Wenzel Jakob
0871228f42 opaque<> clarifications 2016-04-22 16:52:15 +02:00
Wenzel Jakob
54b6fdd43d starting work on the v1.6 release 2016-04-21 12:29:17 +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
8bd31c71e4 New automatic return value policy for cat() and make_tuple(), fixed an ambiguity issue 2016-04-14 15:00:30 +02:00
Wenzel Jakob
2e03a5857c added comment about cmake issues (#99) 2016-04-14 11:27:15 +02:00
Wenzel Jakob
b282595bba convenience wrapper for constructing iterators (fixes #142) 2016-04-14 00:23:37 +02:00
Wenzel Jakob
ef7a9b9a3f added info about autogenerated Sphinx docs (fixes #112) 2016-04-13 18:41:59 +02:00
Wenzel Jakob
d7efa4ff7b return best representation of polymorphic types (fixes #105) 2016-04-13 13:51:33 +02:00
Wenzel Jakob
d40885a1e6 clarified pickling docs 2016-04-13 13:30:05 +02:00
Wenzel Jakob
3d0e6fff25 typos 2016-04-13 11:48:10 +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
50ed3614de added a faq entry about import issues 2016-04-11 17:38:25 +02:00
Wenzel Jakob
90d2f5e2fc added a comment about symbol visibility 2016-04-11 14:30:11 +02:00
Wenzel Jakob
978e376e57 documentation improvements 2016-04-07 18:00:41 +02:00
Wenzel Jakob
1e1f3675cd added limitations section 2016-04-07 10:31:01 +02:00
Wenzel Jakob
33c2a0494f minor documentation update 2016-04-07 09:06:49 +02:00
Wenzel Jakob
95dc0695b7 starting work on version 1.5 2016-04-07 08:59:15 +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
9f0dfce84b returning unique pointers is now allowed 2016-04-06 17:38:18 +02:00
Wenzel Jakob
76eb607d4e completed type table 2016-03-21 17:53:39 +01:00
Wenzel Jakob
eda978e003 support for opaque types 2016-03-15 15:07:55 +01:00
Wenzel Jakob
a3e34f4a5f comment about old versions of visual studio 2016-03-15 15:06:47 +01:00
Wenzel Jakob
4a48afb356 doc updates 2016-03-09 21:31:21 +01:00
Wenzel Jakob
de623a7668 added faq 2016-03-09 21:11:19 +01:00
Wenzel Jakob
4e455dde0b updated changelog, added build directory to gitignore file 2016-03-09 16:50:40 +01:00
Wenzel Jakob
14cefbf473 minor fix for conda release process 2016-03-09 09:56:37 +01:00
Sylvain Corlay
e6464ad843 Update release instructions 2016-03-08 19:37:24 -05:00
Wenzel Jakob
81dfd2c51f Working type casters for wide strings and wide characters 2016-03-08 20:48:07 +01:00
Wenzel Jakob
504f7553e3 starting to work on next version 2016-03-08 18:12:24 +01:00
Wenzel Jakob
d2385e8fc6 ready for version 1.3 2016-03-08 18:09:50 +01:00
Wenzel Jakob
8d862b37b4 documentation updates (clarified cross-module dependencies, added contributors, improved CSS) 2016-03-06 13:37:22 +01:00
Wenzel Jakob
c769fce280 note about nullptr default args 2016-03-03 12:03:30 +01:00
Wenzel Jakob
4f972c0039 Revert of the revert of the python package with version information
This reverts commit bee8f16dbb.
2016-03-01 10:37:37 +01:00
Wenzel Jakob
cf2b87aa5e changelog update 2016-02-22 17:32:44 +01:00
Wenzel Jakob
bee8f16dbb removed 'pybind11' package which ultimately served no purpose 2016-02-22 17:29:30 +01:00
Wenzel Jakob
240e4044aa added note about supported compiler versions 2016-02-20 21:01:47 +01:00
Wenzel Jakob
0880294924 support unordered set/map data structures (fixes #100) 2016-02-13 00:22:26 +01:00
Wenzel Jakob
8ed2808239 pybind11, version 1.2 2016-02-07 17:32:37 +01:00
Wenzel Jakob
43b6a23a89 minor comment about binding static methods 2016-02-07 17:24:41 +01:00
Wenzel Jakob
10c74c6f34 transparent std::array conversion (fixes #97) 2016-02-07 16:36:51 +01:00
Wenzel Jakob
c91551b33b improved python detection in CMakeLists.txt (fixes #98) 2016-02-07 15:57:14 +01:00
Wenzel Jakob
de3ad07899 documentation on exporting constants (closes #92) 2016-02-02 11:38:21 +01:00
Sylvain Corlay
97dc81057f Add version info and release instructions for pybind11 2016-02-01 10:23:52 -05:00
Wenzel Jakob
cd4e6ae3f0 updated changelog 2016-01-29 11:48:40 +01:00