Fix class member division operator.
Define the nb_divide/nb_inplace_divide slots in the interface and use it them as nb_divide/nb_inplace_divide for Python 2.x and as nb_true_divide/nb_inplace_trus_divide for Python 3.x. The Python 3.x nb_floor_divide/nb_inplace_floor_divide slots (operator // in Python) are not populated by the interface.
This commit is contained in:
parent
6fca1ee0b0
commit
cf370fb504
3 changed files with 5 additions and 13 deletions
|
|
@ -103,7 +103,7 @@
|
|||
%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);
|
||||
%pybinoperator(__div__, *::operator/, binaryfunc, nb_divide);
|
||||
%pybinoperator(__mod__, *::operator%, binaryfunc, nb_remainder);
|
||||
%pybinoperator(__lshift__, *::operator<<, binaryfunc, nb_lshift);
|
||||
%pybinoperator(__rshift__, *::operator>>, binaryfunc, nb_rshift);
|
||||
|
|
@ -117,8 +117,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~;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue