Merge branch 'ejulien-python_operator_overload_test_suite'
* ejulien-python_operator_overload_test_suite: Add __str__ to operator_overload testcase for python builtin Python operator_overload runtime testcase cleanup Work around a limitation of the Python binding generator related to the += family of operators. Fix Python 3 division member operator when -builtin is not used. Fix class member division operator. Remove the PY3BUILTIN switch as its behavior can be achieved with the existing SWIG_FEATURES=-builtin switch. Implement the operator overload test suite for Python. Conflicts: Examples/test-suite/operator_overload.i
This commit is contained in:
commit
5e6ab1d61d
4 changed files with 98 additions and 10 deletions
|
|
@ -103,7 +103,11 @@
|
|||
%pybinoperator(__neg__, *::operator-(), unaryfunc, nb_negative);
|
||||
%pybinoperator(__neg__, *::operator-() const, unaryfunc, nb_negative);
|
||||
%pybinoperator(__mul__, *::operator*, binaryfunc, nb_multiply);
|
||||
%pybinoperator(__div__, *::operator/, binaryfunc, nb_div);
|
||||
#if defined(SWIGPYTHON_PY3)
|
||||
%pybinoperator(__truediv__, *::operator/, binaryfunc, nb_divide);
|
||||
#else
|
||||
%pybinoperator(__div__, *::operator/, binaryfunc, nb_divide);
|
||||
#endif
|
||||
%pybinoperator(__mod__, *::operator%, binaryfunc, nb_remainder);
|
||||
%pybinoperator(__lshift__, *::operator<<, binaryfunc, nb_lshift);
|
||||
%pybinoperator(__rshift__, *::operator>>, binaryfunc, nb_rshift);
|
||||
|
|
@ -117,8 +121,6 @@
|
|||
%pycompare(__eq__, *::operator==, Py_EQ);
|
||||
%pycompare(__ne__, *::operator!=, Py_NE);
|
||||
|
||||
%feature("python:slot", "nb_truediv", functype="binaryfunc") *::operator/;
|
||||
|
||||
/* Special cases */
|
||||
%rename(__invert__) *::operator~;
|
||||
%feature("python:slot", "nb_invert", functype="unaryfunc") *::operator~;
|
||||
|
|
@ -200,7 +202,11 @@ __bool__ = __nonzero__
|
|||
%pyinplaceoper(__iadd__ , *::operator +=, binaryfunc, nb_inplace_add);
|
||||
%pyinplaceoper(__isub__ , *::operator -=, binaryfunc, nb_inplace_subtract);
|
||||
%pyinplaceoper(__imul__ , *::operator *=, binaryfunc, nb_inplace_multiply);
|
||||
#if defined(SWIGPYTHON_PY3)
|
||||
%pyinplaceoper(__itruediv__ , *::operator /=, binaryfunc, nb_inplace_divide);
|
||||
#else
|
||||
%pyinplaceoper(__idiv__ , *::operator /=, binaryfunc, nb_inplace_divide);
|
||||
#endif
|
||||
%pyinplaceoper(__imod__ , *::operator %=, binaryfunc, nb_inplace_remainder);
|
||||
%pyinplaceoper(__iand__ , *::operator &=, binaryfunc, nb_inplace_and);
|
||||
%pyinplaceoper(__ior__ , *::operator |=, binaryfunc, nb_inplace_or);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue