Commit Graph

3442 Commits

Author SHA1 Message Date
Wenzel Jakob
f66610153f FindPythonLibsNew: wasn't actually setting PYTHONLIBS_FOUND contrary to specs 2016-10-09 14:12:24 +02:00
Wenzel Jakob
b55a5c5660 fixed typo in cmake file 2016-10-09 13:51:05 +02:00
Wenzel Jakob
e71ab8f455 unpacking_collector: allow nullptr-valued kwargs argument
This fixes an issue that can arise when forwarding (*args, **kwargs)
captured from a pybind11-bound function call to another Python function.
When the initial function call includes no keyword arguments, the
py::kwargs field is set to nullptr and causes a crash later on.
2016-10-08 15:30:02 +02:00
Wenzel Jakob
ba7678016c numpy.h: added array::squeeze() method 2016-10-07 11:19:57 +02:00
Wenzel Jakob
68a9989298 Merge pull request #429 from jagerman/accessor-bool-operator
Re-add accessor bool operator
2016-10-02 23:15:18 +02:00
Jason Rhinelander
7b8e3f9ec8 Re-add (but deprecated) bool operator for attr/items
PR #425 removed the bool operator from attribute accessors.  This is
likely in use by existing code as it was the only way before #425 added
the `hasattr` function to check for the existence of an attribute, via:

    if (obj.attr("foo")) { ... }

This commit adds it back in for attr and item accessors, but with a
deprecation warning to use `hasattr(obj, ...)` or `obj.contains(...)`
instead.
2016-10-02 16:39:51 -04:00
Wenzel Jakob
103d78d368 failed implicit conversions shouldn't lead to nullptr dereference 2016-09-30 13:43:19 +02:00
Wenzel Jakob
cd4d7d6bf8 very minor caster simplification 2016-09-30 12:20:19 +02:00
Wenzel Jakob
dac3858e7d Make header files viewable in IDEs (fixes #424) 2016-09-29 21:30:00 +02:00
Wenzel Jakob
5699986d12 Merge pull request #427 from dean0x7d/eigen-bases
Simplify base class detection for Eigen types
2016-09-29 21:20:26 +02:00
Dean Moldovan
71af3b07fb Simplify base class detection for Eigen types 2016-09-29 10:38:13 +02:00
Wenzel Jakob
886288787e contributor list update 2016-09-27 18:02:20 +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
Trent Houliston
a3603e6df0 Simplify redundant code, conform to style suggestions, improve logic 2016-09-28 01:01:44 +10:00
Trent Houliston
253e41ccad Relax constraints on testing to ensure they work in all cases. 2016-09-28 00:59:21 +10:00
Wenzel Jakob
b0c4444687 format_descr constexpr tweak for MSVC by @jagerman (fixes #416) 2016-09-27 11:23:59 +02:00
Wenzel Jakob
0a014e9135 Merge pull request #425 from dean0x7d/accessors
Make the accessor interface more complete
2016-09-26 20:35:24 +02:00
Dean Moldovan
2bab5793f7 Later assignments to accessors should not overwrite the original field
`auto var = l[0]` has a strange quirk: `var` is actually an accessor and
not an object, so any later assignment of `var = ...` would modify l[0]
instead of `var`. This is surprising compared to the non-auto assignment
`py::object var = l[0]; var = ...`.

By overloading `operator=` on lvalue/rvalue, the expected behavior is
restored even for `auto` variables.
2016-09-23 02:00:01 +02:00
Dean Moldovan
ea763a57a8 Extend tuple and list accessor interface 2016-09-23 02:00:01 +02:00
Dean Moldovan
242b146a51 Extend attribute and item accessor interface using object_api 2016-09-23 02:00:01 +02:00
Dean Moldovan
865e43034b Make attr and item accessors throw on error instead of returning nullptr
This also adds the `hasattr` and `getattr` functions which are needed
with the new attribute behavior. The new functions behave exactly like
their Python counterparts.

Similarly `object` gets a `contains` method which calls `__contains__`,
i.e. it's the same as the `in` keyword in Python.
2016-09-23 01:40:22 +02:00
Dean Moldovan
37e22e436e Move common object functions into object_api mixin 2016-09-23 01:38:35 +02:00
Wenzel Jakob
2d9220f09d Merge pull request #423 from drufat/a
Use consistent indentation and typenames in numpy vectorize.
2016-09-22 23:57:49 +02:00
Dzhelil Rufat
c250ee5146 Use more consistent indentation and typenames names. 2016-09-22 14:51:41 -07:00
Wenzel Jakob
1ee4128cfe Merge pull request #420 from jagerman/doc-typos
Fix minor documentation spelling mistakes
2016-09-21 19:41:30 +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
bc622dc936 Merge pull request #418 from dean0x7d/fix-missing-test
Fix missing smart_ptr test
2016-09-20 12:31:46 +02:00
Dean Moldovan
568ec6b35a Fix missing smart_ptr test 2016-09-20 11:52:25 +02:00
Wenzel Jakob
d922dffec4 Merge pull request #410 from wjakob/mi
WIP: Multiple inheritance support
2016-09-19 18:55:05 +02:00
Wenzel Jakob
e72a676b72 More verbose error messages when PyType_Ready fails 2016-09-19 13:45:34 +02:00
Wenzel Jakob
c1fc27e2b5 use detail::enable_if_t everywhere 2016-09-19 13:45:34 +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
Wenzel Jakob
e99ebaedcf nicer error message for invalid function arguments 2016-09-19 13:43:43 +02:00
Wenzel Jakob
7962f30d70 set possible build types in cmake build system 2016-09-17 12:58:18 +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
ad3bb9bbab Include the cmath header for std::lround.
Fix spaces before parens for style guide.
2016-09-14 19:27:53 +10: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
207d0da31c Move the python datetime header into the chrono header 2016-09-13 19:58:05 +10:00
Trent Houliston
0ee97dd6d0 Only import PyDateTime if we have to 2016-09-13 19:58:05 +10:00
Trent Houliston
8fe2fa7eba Increase the amount of time to execute the functions to 50ms 2016-09-13 19:58:05 +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
Trent Houliston
6ddfd1e090 Add in casts for c++11s chrono classes to pythons datetime 2016-09-13 19:41:48 +10:00
Wenzel Jakob
29b5064e9c Merge pull request #411 from jagerman/debug-build-and-fix
Debug build and fix
2016-09-13 09:27:09 +09:00
Jason Rhinelander
4a4fb396e7 Fix build under debug mode
Take load_type by nested type_caster template arguments instead of by
full type_caster type.
2016-09-12 16:21:40 -04:00
Jason Rhinelander
5b4968df3a Make the gcc6/python 3.5 build use debug mode 2016-09-12 16:04:31 -04:00
Wenzel Jakob
591a9999c2 Merge pull request #409 from jagerman/dynamic-cast-test
Added a test to detect invalid RTTI caching
2016-09-12 08:17:52 +09:00