Commit Graph

579 Commits

Author SHA1 Message Date
Wenzel Jakob
69e1a5c91b quenched warnings on windows, comments in gil_scoped_release 2016-05-26 14:29:31 +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
60abf299c6 minor cleanups in pytypes.h 2016-05-26 10:47:11 +02:00
Wenzel Jakob
ca9f3b2d8e Merge pull request #213 from yungyuc/yyc-args
pybind11::args should have been derived from tuple
2016-05-25 15:41:18 +02:00
Yung-Yu Chen
114bfeb762 pybind11::args should have been derived from tuple
args was derived from list, but cpp_function::dispatcher sends a tuple to it->impl (line #346 and #392 in pybind11.h).  As a result args::size() and args::operator[] don't work at all.  On my mac args::size() returns -1.  Making args a subclass of tuple fixes it.
2016-05-25 21:09:35 +08:00
Dean Moldovan
03d6a514d2 Fix missing variable for Windows build 2016-05-25 13:39:32 +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
b437867338 eigen.h: relax access to members 2016-05-24 21:40:03 +02:00
Wenzel Jakob
ec10c20ba5 Merge pull request #212 from abergmeier/master
Increase available information on invocation error.
2016-05-24 12:36:32 +02:00
Andreas Bergmeier
2dd215711a Fixed expected test examples for more verbose error output. 2016-05-24 10:15:43 +02:00
Andreas Bergmeier
16d4394845 Increase available information on invocation error. 2016-05-24 09:19:44 +02:00
Dean Moldovan
8c6b0b8333 Don't build tests when project is used via add_subdirectory 2016-05-23 00:12:37 +02:00
Dean Moldovan
b4b70a5d62 Update CMake on Travis CI 2016-05-22 22:45:11 +02:00
Dean Moldovan
4563e9a8cd Add CMake function pybind11_add_module()
The function creates a pybind11 module using the specified source files.
2016-05-22 22:28:08 +02:00
Dean Moldovan
928fff649f Include a more robust FindPythonLibs module for CMake 2016-05-22 20:49:35 +02:00
Wenzel Jakob
bd986fe57e add comment about macro issues (fixes #203) 2016-05-21 10:48:30 +02:00
Wenzel Jakob
02096a057f Merge pull request #204 from thedrow/patch-1
Cache C/C++ compilation
2016-05-21 10:38:56 +02:00
Omer Katz
f74c9236a5 Cache C/C++ compilation 2016-05-21 11:29:30 +03:00
Wenzel Jakob
43b09af3a9 example12 clarifications 2016-05-21 01:11:11 +02:00
Wenzel Jakob
f64ff575d7 mkdoc.py: improved formatting of code segments and enums 2016-05-20 16:37:13 +02:00
Wenzel Jakob
a970a579b2 eigen.h: return compile time vectors as 1D NumPy arrays 2016-05-20 12:01:03 +02:00
Wenzel Jakob
b47a9de035 ability to prevent force casts in numpy arguments 2016-05-19 16:02:09 +02:00
Wenzel Jakob
93a317eca1 Merge pull request #198 from nils-werner/numpy-typo
Fixed typo in NumPy example which prevented compilation
2016-05-19 14:08:20 +02:00
Nils Werner
f7048f25b1 Fixed typo in NumPy example which prevented compilation 2016-05-19 11:17:17 +02:00
Wenzel Jakob
54b4aceafa Merge pull request #197 from RosettaCommons/fix
Refactoring bind_vector to take std::string
2016-05-18 08:25:38 +02:00
Sergey Lyskov
065526a369 Refactoring bind_vector to take std::string to avoid capture of potentially temporary char const * when calling vector_if_insertion_operator 2016-05-17 23:30:58 -04: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
Wenzel Jakob
d1bfc4e0f8 support __bool__ on Python 2.x and 3.x 2016-05-16 18:52:50 +02:00
Wenzel Jakob
00c7d6ccc7 Merge branch 'stl_bind' 2016-05-16 12:33:20 +02:00
Wenzel Jakob
25c03cecfa stl_bind redesign & cleanup pass 2016-05-16 12:12:58 +02:00
Wenzel Jakob
affb9f40c5 quench conversion warnings on windows 2016-05-16 00:04:20 +02:00
Wenzel Jakob
deeab558ba quench strict aliasing warnings 2016-05-16 00:04:20 +02:00
Wenzel Jakob
a380ed9259 consider __setstate__ as a constructor 2016-05-16 00:04:17 +02:00
Sergey Lyskov
26aca3d8ad Adding vector ’extend’ member function 2016-05-15 20:46:07 +02:00
Sergey Lyskov
9ee4f92b06 Refactoring vector_binder so it now a function 2016-05-15 20:46:07 +02:00
Sergey Lyskov
2de5af998d Adding workarounds for MSVC 2015 2016-05-15 20:46:07 +02:00
Sergey Lyskov
7b50cbd870 Fixing VC build, apparently MSVC implementation of std::is_default_constructible had no bool() operator 2016-05-15 20:46:07 +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
Sergey Lyskov
25ac21903a properly adding value_error exception 2016-05-15 20:46:07 +02:00
Sergey Lyskov
a315c7a25a Adding Python-style modifiers for vector. Wrapping has_insertion_operator_implementation in _MSC_VER ifdef’s. Adding ‘!=0’ instead of bool cast’s. 2016-05-15 20:46:07 +02:00
Sergey Lyskov
eae7744c0e adding stl_binders 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
5984baafd0 redesigned cpp_function constructor; significant space savings 2016-05-15 20:23:27 +02:00
Wenzel Jakob
07ef518bbb Merge pull request #194 from jmabille/numpy_ctor
add extra constructors in numpy.h
2016-05-11 14:25:01 +01:00
Johan Mabille
a63d93ba44 constructor fix 2016-05-11 15:03:16 +02:00
Wenzel Jakob
c209323c1f Merge pull request #193 from jmabille/vs_fix
Compilation issue fixed
2016-05-11 13:51:30 +01:00
Johan Mabille
a580ed8c47 Compilation issue fixed 2016-05-11 14:45:01 +02:00
Wenzel Jakob
ace7b4386e switched to conda-forge, updated release process docs 2016-05-10 13:09:33 +01:00
Wenzel Jakob
9f272ddc73 updated testcase reference result 2016-05-08 14:40:57 +02:00