Commit Graph

545 Commits

Author SHA1 Message Date
Wenzel Jakob
fb6aed2157 return value policy clarifications 2016-07-18 20:29:53 +02:00
Wenzel Jakob
1f66a58427 pybind11.h: minor cleanups (no functionality change) 2016-07-18 10:47:10 +02:00
Wenzel Jakob
6969e7c1ba exception handler tweaks (fixes #284) 2016-07-18 10:46:41 +02:00
Wenzel Jakob
d46b6eee5a Merge pull request #285 from jagerman/fix-uninitialized-str
Fix #283: don't print first arg of constructor
2016-07-18 10:09:24 +02:00
Jason Rhinelander
4e45e1805b Fix #283: don't print first arg of constructor
This changes the exception error message of a bad-arguments error to
suppress the constructor argument when the failure is a constructor.

This changes both the "Invoked with: " output to omit the object
instances, and rewrites the constructor signature to make it look
like a constructor (changing the first argument to the object name, and
removing the ' -> NoneType' return type.
2016-07-17 17:47:05 -04:00
Wenzel Jakob
fbdd30e5c5 Merge pull request #278 from jagerman/eigen-test-scipy-dep
Add missing scipy run-time dep to eigen test
2016-07-12 21:00:54 +02:00
Jason Rhinelander
eae180cd0b Add missing scipy run-time dep to eigen test
scipy is imported in pybind11/eigen.h when it encounters a sparse
matrix, which gets tested in the eigen test.
2016-07-12 14:16:46 -04:00
Wenzel Jakob
a720a6046e updated changelog with v1.8.1, updated release instructions 2016-07-12 18:03:17 +02:00
Wenzel Jakob
4d727e10ab minor README.md fix 2016-07-12 16:58:55 +02:00
Wenzel Jakob
59b240a848 bump Intel compiler version requirement 2016-07-12 16:56:47 +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
4e27f7bb13 python 2.7 fix for example 5 2016-07-10 11:01:35 +02: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
52269e91aa Merge pull request #274 from jagerman/report-skipped-tests
Skip eigen test when eigen header available but NumPy not
2016-07-09 20:38:25 +02:00
Jason Rhinelander
7de9f6c72d Tests can skip by exiting with 99; fix eigen test failure
This allows (and changes the current examples) to exit with status 99 to
skip a test instead of outputting a special string ("NumPy missing").

This also fixes the eigen test, which currently fails when eigen
headers are available but NumPy is not, to skip instead of failing when
NumPy isn't available.
2016-07-09 14:33:10 -04:00
Wenzel Jakob
5ba89c340c quench warnings in eigen.h 2016-07-09 15:44:54 +02:00
Wenzel Jakob
678d59d21f Python 2.7 fixes for eval() 2016-07-08 15:14:48 +02:00
Wenzel Jakob
464c43513e further eval() improvements 2016-07-08 15:08:30 +02:00
Wenzel Jakob
5130212d5f appveyor: show output on test failure 2016-07-08 14:03:54 +02:00
Wenzel Jakob
dc13cf0e54 quench warning on windows 2016-07-08 11:07:02 +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
c2ee3f52b5 Merge pull request #272 from jagerman/fix-gcc6-placement-new-warning
Fix gcc6 placement new warning
2016-07-07 22:56:36 +02:00
Jason Rhinelander
0b12f91fa3 Only disable placement-new warning under gcc >= 6
Otherwise this would create unknown option warnings under g++ < 6.
2016-07-07 16:26:04 -04:00
Jason Rhinelander
cae0e00947 Disable -Wplacement-new warning false alarm
GCC-6 adds a -Wplacement-new warning that warns for placement-new into a
space that is too small, which is sometimes being triggered here (e.g.
example5 always generates the warning under g++-6).  It's a false
warning, however: the line immediately before just checked the size, and
so this line is never going to actually be reached in the cases where
the GCC warning is being triggered.

This localizes the warning disabling just to this one spot as there are
other placement-new uses in pybind11 where this warning could warn about
legitimate future problems.
2016-07-07 16:11:42 -04:00
Wenzel Jakob
4be37c17d7 Merge pull request #269 from jagerman/ternary-description
Add _<bool>("s1", "s2") ternary & use TYPE_CASTER
2016-07-06 07:09:00 +02:00
Jason Rhinelander
4609beb46e Merge remote-tracking branch 'upstream/master' into ternary-description 2016-07-06 00:49:49 -04:00
Jason Rhinelander
8469f751cb Add _<bool>("s1", "s2") ternary & use TYPE_CASTER
This commit adds an additional _ template function for compile-time
selection between two description strings.  This in turn allows the
elimination of needing two name() methods in type_caster<arithmetic
types> and type_caster<eigen types>, which allows them to start using
PYBIND11_TYPE_CASTER instead, simplifying their code by eliminating all
the code that they are duplicating from the macro.
2016-07-06 00:40:54 -04:00
Wenzel Jakob
22201d08e4 Merge pull request #268 from bennorth/stricter-test
Tighten check() test in eigen.py
2016-07-06 05:45:56 +02:00
Wenzel Jakob
f57133aa2e correction to #266 fix 2016-07-06 05:43:52 +02:00
Ben North
150a0fa786 check(): Stricter check in tests
Previous version would give false 'OK' if, for example, we were supposed
to get [1, 2, 3] but instead got [2, 1, 3].
2016-07-05 21:46:50 +01:00
Ben North
676e29885b Test that check() catches wrong order of elements
Fails --- next commit will tighten test.
2016-07-05 21:46:50 +01:00
Wenzel Jakob
c2f6841c22 Merge pull request #267 from bennorth/non-contiguous-arrays
Non-contiguous arrays
2016-07-05 22:34:36 +02:00
Ben North
7b8d9e0246 Test eigen converts slices of 3d arrays correctly 2016-07-05 21:13:24 +01:00
Ben North
3e0e779322 Tests: Add further '2*' functions for matrices
Add and declare to Python functions

    double_mat_cm() --- compute 2* a column-major matrix
    double_mat_rm() --- compute 2* a row-major matrix

to 'eigen.cpp' tests / example.
2016-07-05 21:13:24 +01:00
Ben North
93594a3857 Fix handling of one-dimensional input arrays
In eigen.h, type_caster<Type>::load():  For the 'ndim == 1' case, use
the 'InnerStride' type because there is only an inner stride for a
vector.  Choose between (n_elts x 1) or (1 x n_elts) according to
whether we're constructing a Vector or a RowVector.
2016-07-05 21:13:24 +01:00
Ben North
4a22091d45 Add tests for doubling row- and col-vectors
Passing a non-contiguous one-dimensional numpy array gives incorrect
results, so three of these tests fail.  The only one passing is the
simple case where the numpy array is contiguous and we are building a
column-major vector.  Subsequent commit will fix the three failing
cases.
2016-07-05 21:13:20 +01:00
Ben North
b063e64b19 Eigen tests: '2*' functions for col-, row-vectors 2016-07-05 21:12:25 +01:00
Wenzel Jakob
c9f69bc35a Merge pull request #266 from jagerman/fix-python27-test-output
Fix test diff output under python2.7
2016-07-05 22:07:34 +02:00
Jason Rhinelander
f23e0b5e95 Fix test diff output under python2.7
PR #220 broke failed test output under python2.7, which doesn't support
the keepends argument to splitlines.
2016-07-05 16:03:43 -04:00
Wenzel Jakob
3b48482f02 Merge pull request #262 from merlinND/make-tuple-error-message
More informative error message when `py::make_tuple` fails
2016-07-01 21:48:14 +02:00
Merlin Nimier-David
68ca3b6343 more informative error message when py::make_tuple fails 2016-07-01 20:35:35 +02:00
Wenzel Jakob
0006259508 switched internal usage of cast_error exception to reference_cast_error 2016-07-01 16:07:35 +02:00
Wenzel Jakob
472ffbba96 more informative error message when py::cast fails 2016-07-01 16:07:24 +02:00
Wenzel Jakob
fb0e2e5dac minor formatting fix 2016-07-01 14:54:24 +02:00
Wenzel Jakob
d7e208c740 Merge pull request #260 from hbruintjes/allow_const_shared
Allow std::enable_shared_from_this when using const element type
2016-07-01 13:38:46 +02:00