Commit Graph

1157 Commits

Author SHA1 Message Date
Wenzel Jakob
7c99ff2a00 fix segfault when passing a docstring to def_property* (fixes #222) 2016-06-02 20:34:01 +02:00
Dean Moldovan
f2b36c2ed2 Fix a couple of warnings
- Conversion warning on clang: 'long' to 'size_t'
- Unused variable warning on MSVC
2016-06-01 23:48:23 +02:00
Wenzel Jakob
38d8b8cfe2 don't allow registering a class twice (fixes #218) 2016-05-31 09:53:28 +02:00
Wenzel Jakob
5eda97d7e4 gcc fix 2016-05-30 11:45:02 +02:00
Wenzel Jakob
b569272127 quench some Eigen-related warnings 2016-05-30 11:37:07 +02:00
Wenzel Jakob
5dd33d880d fix issues with std::vector<bool> overload in STL (fixes #216) 2016-05-30 11:28:21 +02:00
Wenzel Jakob
0a07805ab6 fixed many conversion warnings on clang 2016-05-29 13:40:40 +02:00
Wenzel Jakob
c48da92561 Merge branch 'cygwin' of https://github.com/BorisSchaeling/pybind11 into BorisSchaeling-cygwin 2016-05-29 12:46:21 +02:00
Boris Schäling
20ee935203 Use decltype to deduce return type of PyThread_create_key 2016-05-28 12:26:18 +02:00
Boris Schäling
8965644536 Make examples build and run on Cygwin 2016-05-26 22:42:07 +02:00
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
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
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
Andreas Bergmeier
16d4394845 Increase available information on invocation error. 2016-05-24 09:19:44 +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
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
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
Johan Mabille
a63d93ba44 constructor fix 2016-05-11 15:03:16 +02:00
Johan Mabille
a580ed8c47 Compilation issue fixed 2016-05-11 14:45:01 +02:00
Wenzel Jakob
6c03beb867 enable *args and **kwargs notation (closes #190) 2016-05-08 14:34:09 +02:00
Wenzel Jakob
e611823e4c quench warning on osx 2016-05-05 21:54:30 +02:00
Wenzel Jakob
9e0a0568fe transparent conversion of dense and sparse Eigen types 2016-05-05 21:44:29 +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
ad69634907 minor cleanups 2016-05-03 13:36:32 +02:00
Wenzel Jakob
aadc2f3d8c cast(): use cast_op_type mechanism 2016-05-03 13:27:57 +02:00
Wenzel Jakob
6d2529613a fix incorrect in macro if statement 2016-05-01 20:47:49 +02:00
Wenzel Jakob
bd57eb484d don't try to cast 'None' into a C++ lvalue reference 2016-05-01 14:42:20 +02:00
Wenzel Jakob
6fb48490ef fix crash when None is passed to enum::operator== 2016-05-01 12:45:38 +02:00
Wenzel Jakob
2bc946bd7a copy/move constructor detection workaround (MSVC 2015 bug) 2016-05-01 10:28:00 +02:00
Wenzel Jakob
5612a0c1c2 generalized str::operator std::string() to accept 'bytes'(3.x)/'string'(2.7) 2016-05-01 00:32:18 +02:00
Wenzel Jakob
fc92d82bba added [[noreturn]] attribute to pybind11_fail 2016-04-30 23:55:44 +02:00
Wenzel Jakob
8edfa0c10f further simplifications to shared_ptr caster 2016-04-30 23:01:06 +02:00
Wenzel Jakob
ffd85b46d8 return value policy fix for functions returning std::shared_ptr<> (fixes #187) 2016-04-30 22:41:05 +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
1959d18c48 fixed return value type in py::make_iterator 2016-04-30 21:42:17 +02:00
Wenzel Jakob
772c6d54d6 enable passing C++ instances to void*-valued arguments 2016-04-30 21:28:45 +02:00
Wenzel Jakob
e8b9dd263c fixed docstring generation for void pointers 2016-04-30 19:35:24 +02:00
Wenzel Jakob
fd7cf51a56 enabled casting of const void* 2016-04-30 19:25:37 +02:00
Wenzel Jakob
06f56ee1e9 opaque type redesign 2016-04-28 17:49:46 +02:00
Wenzel Jakob
6ca6e82f7c fix various iterator issues (fixes #181) 2016-04-27 14:33:52 +02:00
Wenzel Jakob
a01977ec96 pytypes noexcept annotations 2016-04-27 02:39:36 +02:00
Wenzel Jakob
e84f557edf documentation improvements 2016-04-26 23:48:55 +02:00
Wenzel Jakob
19dfc50d10 is_move_constructible simplification 2016-04-25 23:49:03 +02:00
Wenzel Jakob
f7b5874ca3 new move value policy 2016-04-25 23:04:27 +02:00
Wenzel Jakob
fbafdea672 a few more GIL-related compatibility fixes 2016-04-25 17:48:56 +02:00
Wenzel Jakob
17b10d7cbf functional.h: acquire GIL before calling Python function 2016-04-25 09:17:41 +02:00
Wenzel Jakob
2f6662e174 Python 2.7.x fixes for new gil_scoped_release 2016-04-25 09:16:41 +02:00
Wenzel Jakob
084ca0e553 compilation fixes 2016-04-25 04:00:47 +02:00
Wenzel Jakob
39e97e6a49 significant redesign of GIL state handling 2016-04-25 03:27:32 +02:00
Wenzel Jakob
18fb3e323a added a pybind11::none class 2016-04-25 03:27:32 +02:00
Wenzel Jakob
9b880ba743 keep_alive: don't fail when there is no patient 2016-04-25 03:26:36 +02:00
Wenzel Jakob
7d0162a2df minor cleanups 2016-04-25 03:26:35 +02:00
Wenzel Jakob
7ca2755880 new type wrapper for iterable objects 2016-04-22 09:33:19 +02:00
Wenzel Jakob
54b6fdd43d starting work on the v1.6 release 2016-04-21 12:29:17 +02:00
Wenzel Jakob
dbe43ffcce completed implicit type casters for reference_wrapper 2016-04-21 12:21:14 +02:00
Wenzel Jakob
f54ded74f1 added caster for std::reference_wrapper (fixes #171) 2016-04-20 17:00:57 +02:00
Wenzel Jakob
e65e58716e slight generalization of cast_op_type 2016-04-18 21:22:22 +02:00
Wenzel Jakob
8cb6cb33ef minor cleanups in common.h; updated author info and copyright year 2016-04-18 10:53:38 +02:00
Wenzel Jakob
bf0c7dcc22 convenience overload for make_iterator() 2016-04-18 10:52:12 +02:00
Wenzel Jakob
1dc940d4b7 quenched -pendantic warnings (closes #167) 2016-04-18 10:41:44 +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
b282595bba convenience wrapper for constructing iterators (fixes #142) 2016-04-14 00:23:37 +02:00
Wenzel Jakob
5a6aa49105 Added len() function 2016-04-13 22:48:05 +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
505466ff0e added variadic make_tuple() function 2016-04-13 02:49:03 +02:00
Wenzel Jakob
f5c154ade9 address issue with virtual function dispatch (fixes #159) 2016-04-11 18:13:08 +02:00
Wenzel Jakob
95dc0695b7 starting work on version 1.5 2016-04-07 08:59:15 +02:00
Wenzel Jakob
9f0dfce84b returning unique pointers is now allowed 2016-04-06 17:38:18 +02:00
Wenzel Jakob
a3ee1a4591 improved pair type caster (fixes #155) 2016-04-06 11:51:00 +02:00
Wenzel Jakob
912feec119 improve debug error message when default parameter construction fails 2016-04-01 12:17:10 +02:00
Wenzel Jakob
b90e68de7e another corner case (fixes #151) 2016-03-27 00:19:32 +01:00
Wenzel Jakob
08927e9809 tabs->spaces 2016-03-26 23:38:46 +01:00
Wenzel Jakob
9883ec01d7 allow nullptr string values (closes #138) 2016-03-26 23:37:51 +01:00
Wenzel Jakob
7393343f69 removed unnecessary code 2016-03-26 23:04:40 +01:00
Wenzel Jakob
d3349af48b modularized logic in preceding change, fixed issue with char (fixes #150) 2016-03-26 23:04:10 +01:00
Wenzel Jakob
0772967ecf allow nullptr when passing void* values 2016-03-26 20:41:28 +01:00
Wenzel Jakob
de1bca864e added feature to pass void* pointers by popular demand 2016-03-26 17:51:09 +01:00
Wenzel Jakob
12cf543804 address compilation issue in MSVC 2016-03-26 17:29:33 +01:00
Wenzel Jakob
048373c1b4 explicitly route type casting operations to desired casting operator (fixes #147) 2016-03-26 17:21:19 +01:00
Wenzel Jakob
0b4895885b improve default parameters for properties 2016-03-25 16:13:10 +01:00
Wenzel Jakob
84ec78feeb minor redesign/generalization of def_property mechanism 2016-03-21 17:54:24 +01:00
Wenzel Jakob
eda978e003 support for opaque types 2016-03-15 15:07:55 +01:00
Ben Pritchard
1b52246f5d Better testing for callable python functions 2016-03-10 16:31:38 -05:00
Wenzel Jakob
17cdb06c1b fix severe regression involving character arrays (fixes #137) 2016-03-10 13:24:10 +01:00
Wenzel Jakob
eb5277b38e Merge pull request #119 from SylvainCorlay/docstring
Signature formatting for sphinx
2016-03-09 16:37:44 +01:00
Sylvain Corlay
4c7bf9bb94 Add return type 2016-03-08 18:44:04 -05:00
Sylvain Corlay
0e04fdf3f6 Add generic signature for overloads 2016-03-08 17:22:22 -05:00
Sylvain Corlay
13b22bf4f6 Signature formatting for sphinx 2016-03-08 16:06:05 -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
309a85ba59 support std::shared_ptr<const X> and types that indirectly derive from std::enable_shared_from_this 2016-03-08 17:59:10 +01:00
Wenzel Jakob
77586fd6a2 add version suffix to internal pybind11 data structures to avoid conflicts with future versions 2016-03-06 13:50:26 +01:00
Wenzel Jakob
bce8a4b95c force explicit cast (fixes #130) 2016-03-06 13:30:23 +01:00
Ben Pritchard
f4902ece17 Use emplace for casting to map 2016-03-05 17:36:46 -05:00
Wenzel Jakob
52f4c3aef3 handle nullptr arguments with custom holder types (fixes #124) 2016-03-03 14:05:06 +01:00
hulucc
a88334f9c2 add wchar_t caster 2016-03-02 15:07:08 +08:00
hulucc
c8f68b3d92 add wstring caster 2016-03-02 13:59:39 +08:00
Wenzel Jakob
218b6ce246 Revert "trim docstrings (closes #112)"
This reverts commit b3ef54a544.
2016-02-28 23:52:37 +01:00
Johan Mabille
25dd4789a8 Python overloading of virtual functions defined in class template 2016-02-28 23:26:29 +01:00
Wenzel Jakob
b3ef54a544 trim docstrings (closes #112) 2016-02-24 13:49:04 +01:00
Wenzel Jakob
4a50fa5cd4 Address issue with handle::cast<bool>(), quench warning in example 12 (fixes #110) 2016-02-23 23:51:01 +01:00
Wenzel Jakob
347e6eaf68 allow a broader set of types in STL containers 2016-02-23 17:37:10 +01:00
Wenzel Jakob
82ba330080 stl.h: transparent conversion of STL linked lists 2016-02-23 17:28:45 +01:00
Wenzel Jakob
a3861b54c4 type_caster_generic::load(): accept Py_None as input 2016-02-23 13:37:14 +01:00
Wenzel Jakob
d6e4cef65f minor formatting changes, removed missing header files referenced in setup.py 2016-02-20 12:17:17 +01:00
Wenzel Jakob
5e31d891fc Merge pull request #102 from jmabille/vectorize 2016-02-20 12:15:31 +01:00
Johan Mabille
1dc960c37f NumPy-style broadcasting support in pybind11::vectorize 2016-02-20 12:14:52 +01:00
Ben Pritchard
33f3430d0c Add intel warning push/pop 2016-02-18 15:25:51 -05:00
Ben Pritchard
2de6e1d142 Remove some unnecessary semicolons (compilers warn on higher levels) 2016-02-18 13:20:15 -05:00
Ben Pritchard
70ee47ddcf Add Intel to cmake file. Supress Intel inline/noinline warning 2016-02-18 13:06:43 -05:00
Ben Pritchard
0b6cff3d1d Fixes for compilation/segfault problems with Intel (issue 94) 2016-02-18 12:38:27 -05:00
Wenzel Jakob
f8584b630b quench some warnings in operators.h 2016-02-16 13:36:04 +01:00
Wenzel Jakob
0880294924 support unordered set/map data structures (fixes #100) 2016-02-13 00:22:26 +01:00
Wenzel Jakob
4fee179900 better debug info when arg::operator=() fails 2016-02-09 11:31:20 +01:00
Wenzel Jakob
4f8902a931 starting development cycle for v1.3 2016-02-07 17:33:12 +01:00
Wenzel Jakob
8ed2808239 pybind11, version 1.2 2016-02-07 17:32:37 +01:00
Wenzel Jakob
10c74c6f34 transparent std::array conversion (fixes #97) 2016-02-07 16:36:51 +01:00
Wenzel Jakob
1f7a8096b7 support for string default arguments specified as static arrays 2016-02-07 13:29:17 +01:00
Wenzel Jakob
e206564ebf removed a redundant tag 2016-02-04 23:29:29 +01:00
Wenzel Jakob
a65017902e set __module__ attribute of functions (fixes #95) 2016-02-04 23:03:58 +01:00
Wenzel Jakob
b6cf75d66a address issue with std::type_info across module boundaries (fixes #86) 2016-01-29 11:39:32 +01:00
Felipe Lema
2547ca468c deal with Python versions compiled without thread support (fixes #81) 2016-01-28 18:16:42 +01:00
Wenzel Jakob
15f6a0030e enum comparison and conversion operations (closes #80) 2016-01-24 14:05:12 +01:00
Wenzel Jakob
fa92f6796f Merge pull request #76 from ax3l/fix-unusedVar
Close #69 Unused Var: Warning
2016-01-21 19:03:51 +01:00
Axel Huebl
30214adc0a Fix #75 <complex> may define macro I
Fix #75 as described by undefining the macro `I` from `<complex>`
if defined (as in `glibc`).

This seems to be the only include of it.
2016-01-21 17:44:43 +01:00
Axel Huebl
2dd5e3bc2a Close #69 Unused Var: Warning
Close #69
[This](http://stackoverflow.com/a/3418951)
stackoverflow post recommended
[that](http://herbsutter.com/2009/10/18/mailbag-shutting-up-compiler-warnings/)
Herb Sutter blog post with a general and portable solution and it
works great! :)
2016-01-21 17:18:47 +01:00
Wenzel Jakob
80a06745d3 hopefully final(?) adjustment to detail::is_copy_constructible (fixes #70) 2016-01-20 11:34:07 +01:00
Wenzel Jakob
b670b77060 minor adjustment to detail::is_copy_constructible (fixes #70) 2016-01-20 01:26:43 +01:00
Wenzel Jakob
88d1d04132 another attempt to fix the offsetof warnings 2016-01-20 01:26:42 +01:00
Axel Huebl
7cd569c703 Fix Compile Error: str Naming
This fixes a build error compiling with `nvcc/7.5` + `gcc/4.9.2`
causing a
```
./include/pybind11/pybind11.h(952): here

./include/pybind11/pytypes.h: In member function ‘pybind11::str pybind11::handle::str() const’:
./include/pybind11/pytypes.h:269:8: error: expected primary-expression before ‘class’
     return pybind11::str(str, false);
        ^
./include/pybind11/pytypes.h:269:8: error: expected ‘;’ before ‘class’
./include/pybind11/pytypes.h:269:8: error: expected primary-expression before ‘class’
```
2016-01-19 01:26:52 +01:00
Wenzel Jakob
260bc58f57 improved SFINAE in type_caster_generic (closes #70) 2016-01-18 22:15:20 +01:00
Wenzel Jakob
92b2f452f0 fix regression in stl.h 2016-01-18 22:15:20 +01:00
Wenzel Jakob
2983d5e1de quench warnings (closes #69) 2016-01-18 22:15:16 +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
Wenzel Jakob
53b26549d0 python 3.2 compatiblity (closes #56) 2016-01-17 22:31:15 +01:00
Wenzel Jakob
ba0732e7dc fixed a terrible bug in def_property_static and switched to the faster PyObject_CallFunctionObjArgs API call 2016-01-17 22:31:15 +01:00
Wenzel Jakob
678d787ca4 do more work with classes from pytypes.h (especially for STL container casting) 2016-01-17 22:31:15 +01:00
Wenzel Jakob
d561cb010c fully moved __pybind11__ Python attributes to the C++ side, cleanup & documentation pass over the main header file 2016-01-17 22:31:15 +01:00
Wenzel Jakob
e45b29047a numpy.h: fixed a leak, added some comments to buffer_info 2016-01-17 22:31:15 +01:00
Wenzel Jakob
d33361a6d7 moved lifetime management of Py_buffer to pybind11::buffer_info, renamed count->size to match NumPy naming (fixes #34) 2016-01-17 22:31:15 +01:00
Wenzel Jakob
95d18691c9 minor fixes & removed a leak when freeing functions 2016-01-17 22:31:15 +01:00
Wenzel Jakob
b2c2c79240 improved handling of shared/smart pointers
Previously, pybind11 required classes using std::shared_ptr<> to derive
from std::enable_shared_from_this<> (or compilation failures would ensue).

Everything now also works for classes that don't do this, assuming that
some basic rules are followed (e.g. never passing "raw" pointers of
instances manged by shared pointers). The safer
std::enable_shared_from_this<> approach continues to be supported.
2016-01-17 22:31:15 +01:00
Wenzel Jakob
2ca07de83c minor fix for PYBIND11_OBJECT_CVT 2016-01-17 22:31:15 +01:00
Wenzel Jakob
5f218b3f2c keep_alive call policy (analogous to Boost.Python's with_custodian_and_ward, fixes #62) 2016-01-17 22:31:15 +01:00
Wenzel Jakob
87187afe91 switch NumPy array to object API, avoid unnecessary copy operation in vectorize 2016-01-17 22:31:15 +01:00
Wenzel Jakob
87dfad6544 avoid naming clashes with numpy (fixes #36) 2016-01-17 22:31:15 +01:00
Wenzel Jakob
4177ed4336 renamed decay -> intrinsic_type (fixes #59) 2016-01-17 22:31:15 +01:00
Wenzel Jakob
82ffd40870 type of void fixed (None -> NoneType) 2016-01-17 22:31:15 +01:00
Wenzel Jakob
56e9f4942b improved signature names for subclasses of pybind11::handle 2016-01-17 22:31:15 +01:00
Wenzel Jakob
d0325bbd97 switched a few admissible cases from PyTuple_Set/GetItem -> PyTuple_SET/GET_ITEM 2016-01-17 22:31:15 +01:00
Wenzel Jakob
27e8e1066b added new type pybind11::bytes, cleanup of various macros (fixes #49) 2016-01-17 22:31:15 +01:00
Wenzel Jakob
4c1a6be4bd minor cleanups in numpy.h, updated gitignore file for ninja 2016-01-17 22:31:15 +01:00
Wenzel Jakob
f4671f6a04 use RAII in dispatcher to avoid refcount leaks in certain circumstances when handling exceptions 2016-01-17 22:31:15 +01:00
Wenzel Jakob
66c9a40213 Much more efficient generation of function signatures, updated docs
This modification taps into some newer C++14 features (if present) to
generate function signatures considerably more efficiently at compile
time rather than at run time.

With this change, pybind11 binaries are now *2.1 times* smaller compared
to the Boost.Python baseline in the benchmark. Compilation times get a
nice improvement as well.

Visual Studio 2015 unfortunately doesn't implement 'constexpr' well
enough yet to support this change and uses a runtime fallback.
2016-01-17 22:31:15 +01:00
Wenzel Jakob
2ac5044a05 moved processing of cpp_function arguments out of dispatch code
The cpp_function class accepts a variadic argument, which was formerly
processed twice -- once at registration time, and once in the dispatch
lambda function. This is not only unnecessarily slow but also leads to
code bloat since it adds to the object code generated for every bound
function. This change removes the second pass at dispatch time.

One noteworthy change of this commit is that default arguments are now
constructed (and converted to Python objects) right at declaration time.
Consider the following example:

py::class_<MyClass>("MyClass")
    .def("myFunction", py::arg("arg") = SomeType(123));

In this case, the change means that pybind11 must already be set up to
deal with values of the type 'SomeType', or an exception will be thrown.
Another change is that the "preview" of the default argument in the
function signature is generated using the __repr__ special method. If
it is not available in this type, the signature may not be very helpful,
i.e.:

|  myFunction(...)
|      Signature : (MyClass, arg : SomeType = <SomeType object at 0x101b7b080>) -> None

One workaround (other than defining SomeType.__repr__) is to specify the
human-readable preview of the default argument manually using the more
cumbersome arg_t notation:

py::class_<MyClass>("MyClass")
    .def("myFunction", py::arg_t<SomeType>("arg", SomeType(123), "SomeType(123)"));
2016-01-17 22:31:15 +01:00
Wenzel Jakob
f08a3f0622 Merge pull request #52 from tmiasko/const-correctness
Make handle and related classes const correct.
2016-01-10 21:34:55 +01:00
Wenzel Jakob
deadbbb671 Merge pull request #57 from tmiasko/conversion
Use object class to hold partially converted python objects.
2016-01-07 00:08:38 +01:00
Tomasz Miąsko
ca77130be8 Use object class to hold partially converted python objects.
Using object class to hold converted object automatically deallocates
object if an exception is thrown or scope is left before constructing
complete Python object.

Additionally added method object::release() that allows to release
ownership of python object without decreasing its reference count.
2016-01-02 21:07:18 +01:00
Wenzel Jakob
3367cecc6b detect unreferenced keyword arguments in function calls 2015-12-30 18:48:20 +01:00
Tomasz Miąsko
5d53ac4cbf Clean the type name alone, not the whole message. 2015-12-28 08:49:17 +01:00
Tomasz Miąsko
875df5528d Make handle and related classes const correct.
This gives handle classes a typical pointer semantics with respects to
constness.
2015-12-28 08:11:16 +01:00
Wenzel Jakob
45f7c65594 Merge pull request #50 from tmiasko/handle_cast_const
Add const modifier to handle::cast.
2015-12-27 17:29:24 +01:00
Tomasz Miąsko
c83e062263 Create an empty python tuple in pybind::tuple default constructor.
Follow the same semantics as constructors of dict, list, and set by
creating valid Python object in default constructor of a tuple class.
2015-12-27 09:05:25 +01:00
Tomasz Miąsko
cc39b2f37f Add const modifier to handle::cast. 2015-12-26 19:01:28 +01:00
Wenzel Jakob
dd57a34e2d improved error handling at module import time 2015-12-26 14:04:52 +01:00
Wenzel Jakob
9d573f44b9 stl.h fix for std::map (see PR #43) 2015-12-26 13:37:59 +01:00
Wenzel Jakob
4b279327a3 stl.h bugfix for std::set, misc. cleanups 2015-12-18 18:41:36 +01:00
Wenzel Jakob
d1a24823bc considerable simplifications to the Python type casters 2015-12-16 12:17:46 +01:00
Wenzel Jakob
9b0b40e0b0 add converter for nullptr_t 2015-12-16 11:41:53 +01:00
Wenzel Jakob
6621c17f10 Merge pull request #38 from adler-j/issue-37__convert_exception
ENH: add more error conversions
2015-12-15 12:25:12 +01:00
Jonas Adler
2b9fdbe7c9 ENH: add more error conversions 2015-12-15 11:56:12 +01:00
Jan Dohl
ab92eb3765 Fixed py:array constructor from failing for complex types
The array(const buffer_info &info) constructor fails when given
complex types since their format string is 'Zd' or 'Zf' which has
a length of two and causes an error here:

if (info.format.size() != 1)
    throw std::runtime_error("Unsupported buffer format!");

Fixed by allowing format sizes of one and two.
2015-12-15 04:16:49 +01:00
Wenzel Jakob
62127a27b0 don't allow 'void' or 'void*' as a function argument 2015-12-13 13:09:42 +01:00
Wenzel Jakob
60c36db1c9 generic integer type handling 2015-11-30 12:45:34 +01:00
Wenzel Jakob
7f8d1c20f1 improved int_ constructor 2015-11-29 13:48:16 +01:00
Wenzel Jakob
4ee0f2a19e add missing instructor for bool_ 2015-11-29 13:47:10 +01:00
Wenzel Jakob
e1b113b0d9 ifdef WIN32 -> _WIN32 2015-11-28 14:20:38 +01:00
Wenzel Jakob
6e213c9ca0 improved shared pointer support (fixes #14) 2015-11-24 23:18:32 +01:00
Wenzel Jakob
eb7c0b82ec functional.h: support more kinds of Python functions 2015-11-16 18:39:43 +01:00
Wenzel Jakob
3ee91b2f0a renamed pybind11::set::insert -> add to match C api naming 2015-11-15 13:03:07 +01:00
Wenzel Jakob
333e889ef2 Improved STL support, support for std::set 2015-11-14 19:04:49 +01:00
Wenzel Jakob
723bc65b27 fix for std::shared_ptr proposed by Vayu (fixes #8) 2015-11-12 23:27:20 +01:00
Wenzel Jakob
54289302bc minor cleanups 2015-10-26 20:10:24 +01:00
Wenzel Jakob
5db63fb746 work around weird macro substitution issue on GCC (fixes issue #7) 2015-10-22 21:38:32 +02:00
Wenzel Jakob
fa1bfb2ec7 do a fallback search over types to handle incompatible std::type_info* across module boundaries (fixes issue #4) 2015-10-22 16:04:53 +02:00
Wenzel Jakob
3419ee909f fix linux 32 bit builds 2015-10-21 11:07:48 +02:00
Wenzel Jakob
ad7bc01d51 fix build on linux 2015-10-20 01:11:17 +02:00
Wenzel Jakob
0fb8528edf factored out some common functionality to a non-templated parent class 2015-10-19 23:53:22 +02:00
Wenzel Jakob
b1b714023a consistent macro naming throughout the project 2015-10-18 16:48:30 +02:00
Wenzel Jakob
8f4eb00690 last breaking change: be consistent about the project name 2015-10-15 18:23:56 +02:00
Wenzel Jakob
db028d685c added module::import statement 2015-10-13 23:44:25 +02:00
Wenzel Jakob
b50872acf2 A few breaking changes for consistency just before the 1.0 release
1. Renamed PYTHON_* to PYBIND_* everywhere

2. Renamed pybind::array_dtype<> to pybind::array_t<>
2015-10-13 17:46:31 +02:00
Wenzel Jakob
19208fe9a4 install a cleanup handler for nontrivial lambda closures 2015-10-13 17:46:27 +02:00
Wenzel Jakob
8456a4dca2 minor enum_ improvement (use __repr__ instead of __str__) 2015-10-13 03:03:06 +02:00
Wenzel Jakob
215fc6a4ce simplified string casters, removed wide char support (inconsistent across platforms, better to use utf8 in any case..) 2015-10-13 03:03:01 +02:00
Wenzel Jakob
d2a902bd45 quench a warning on windows 2015-10-04 20:24:20 +02:00
Wenzel Jakob
b3ee3eaf81 emit a more useful error message when a return value can't be converted to a Python type 2015-10-04 15:17:34 +02:00
Wenzel Jakob
edbdef7ccf fixed pybind::call value policy 2015-10-02 09:33:53 +02:00
Wenzel Jakob
6a32620db3 convenience function to create a pybind::handle<> to the python version of a C++ type 2015-10-02 00:42:33 +02:00
Wenzel Jakob
6918922332 allow enums values to be cast to integers 2015-10-01 21:32:23 +02:00
Wenzel Jakob
ac0fde988a don't throw an exception when python deallocates an object which still exists on the C++ side 2015-10-01 18:49:37 +02:00
Wenzel Jakob
6c698fec59 Fix usage of WIN32 define 2015-10-01 17:13:38 +02:00
Wenzel Jakob
a2f6fde0dc support for overriding virtual functions 2015-10-01 17:13:35 +02:00
Wenzel Jakob
04358b02ed Always record the __module__ in newly created Python types 2015-10-01 16:45:28 +02:00
Wenzel Jakob
96c10530aa A few convenience functions for working with Python types
- Get a descriptive string after a Python exception (without changing the exception status)
- Convenience function to map from a C++ object to a Python handle
- Convenience to check if a pybind::function is defined by an underlying
  C++ implementation
- Get the type object of a pybind::handle
2015-10-01 16:44:30 +02:00
Wenzel Jakob
5257330e6a keyword processing bugfix 2015-09-14 16:38:47 +02:00
Wenzel Jakob
73a50a0441 Fix for radd/rsub/rmul/rdiv operator convenience wrappers 2015-09-11 17:09:47 +02:00
Wenzel Jakob
38ffb5232f handle errors in callbacks 2015-09-11 17:01:21 +02:00
Wenzel Jakob
5116b02e68 python 2.7 fix 2015-09-05 02:14:39 +02:00
Wenzel Jakob
570822102c support for ancient Python versions (2.7.x) 2015-09-04 23:49:23 +02:00
Wenzel Jakob
2b0339f44e refcounting fix 2015-09-01 22:51:03 +02:00
Wenzel Jakob
c47fc488d3 win32 build fix 2015-08-30 01:01:47 +02:00
Wenzel Jakob
a750031795 support strongly typed enum 2015-08-29 02:08:32 +02:00
Wenzel Jakob
bce10fae38 windows fixes 2015-08-28 17:58:24 +02:00
Wenzel Jakob
a9ee25a97e various minor compilation fixes 2015-08-28 17:53:31 +02:00
Wenzel Jakob
5d4d83da11 Merge branch 'master' of https://github.com/wjakob/pybind11 2015-08-28 17:49:27 +02:00
Wenzel Jakob
7b8e032c26 added a few basic number types 2015-08-28 17:49:15 +02:00
Wenzel Jakob
328aa14e0a linux compilation fixes 2015-08-26 17:23:23 +02:00
Wenzel Jakob
43dbdfd0e7 Merge branch 'master' of https://github.com/wjakob/pybind11 2015-08-24 15:32:50 +02:00
Wenzel Jakob
f5fae929a3 avoid std::string when creating signatures, and make nicer type names. binary size reduced by ~10% 2015-08-24 15:31:24 +02:00
Wenzel Jakob
d3a4a50207 Merge branch 'master' of https://github.com/wjakob/pybind11 2015-08-04 18:55:07 +02:00
Wenzel Jakob
efd9e987f5 windows fixes 2015-08-04 18:53:18 +02:00
Wenzel Jakob
cd5cda715b cleaned up handling of warnings on clang 2015-08-03 12:17:54 +02:00
Wenzel Jakob
281aa0e668 nicer code separation, cleanup logic, std::function type caster 2015-07-31 04:10:38 +02:00
Wenzel Jakob
a576e6a8ca keyword argument support, removed last traces of std::function<> usage 2015-07-29 23:39:11 +02:00
Wenzel Jakob
71867830f5 switched cpp_function to use variadic arguments 2015-07-29 17:50:57 +02:00
Wenzel Jakob
fbe82bf94d code size reduction 2015-07-28 16:12:29 +02:00
Wenzel Jakob
43398a8548 complex number support 2015-07-28 16:12:20 +02:00
Wenzel Jakob
d4258bafef generate more compact binaries 2015-07-28 03:10:15 +02:00
Wenzel Jakob
2ac80e77aa Better NumPy support 2015-07-22 01:00:06 +02:00
Wenzel Jakob
bd4a529319 more flexible function creation syntax 2015-07-11 18:55:41 +02:00
Wenzel Jakob
38bd71134a Initial commit 2015-07-09 15:27:32 +02:00