Author: Philip Jenvey <pjen...@underboss.org> Branch: py3k Changeset: r74151:15f9e7ef79ce Date: 2014-10-24 00:28 -0700 http://bitbucket.org/pypy/pypy/changeset/15f9e7ef79ce/
Log: readd these, matching cpython 3.2 diff --git a/pypy/objspace/std/complexobject.py b/pypy/objspace/std/complexobject.py --- a/pypy/objspace/std/complexobject.py +++ b/pypy/objspace/std/complexobject.py @@ -13,6 +13,7 @@ from rpython.rlib.rfloat import ( formatd, DTSF_STR_PRECISION, isinf, isnan, copysign, string_to_float) from rpython.rlib.rstring import ParseStringError +from rpython.tool.sourcetools import func_with_new_name HASH_IMAG = 1000003 @@ -393,9 +394,6 @@ return space.w_NotImplemented def _fail_cmp(self, space, w_other): - if isinstance(w_other, W_ComplexObject): - raise oefmt(space.w_TypeError, - "cannot compare complex numbers using <, <=, >, >=") return space.w_NotImplemented def descr_add(self, space, w_rhs): @@ -456,6 +454,19 @@ except ZeroDivisionError, e: raise OperationError(space.w_ZeroDivisionError, space.wrap(str(e))) + def descr_floordiv(self, space, w_rhs): + raise oefmt(space.w_TypeError, "can't take floor of complex number.") + descr_rfloordiv = func_with_new_name(descr_floordiv, 'descr_rfloordiv') + + def descr_mod(self, space, w_rhs): + raise oefmt(space.w_TypeError, "can't mod complex numbers.") + descr_rmod = func_with_new_name(descr_mod, 'descr_rmod') + + def descr_divmod(self, space, w_rhs): + raise oefmt(space.w_TypeError, + "can't take floor or mod of complex number.") + descr_rdivmod = func_with_new_name(descr_divmod, 'descr_rdivmod') + @unwrap_spec(w_third_arg=WrappedDefault(None)) def descr_pow(self, space, w_exponent, w_third_arg): w_exponent = self._to_complex(space, w_exponent) @@ -534,6 +545,12 @@ __rmul__ = interp2app(W_ComplexObject.descr_rmul), __truediv__ = interp2app(W_ComplexObject.descr_truediv), __rtruediv__ = interp2app(W_ComplexObject.descr_rtruediv), + __floordiv__ = interp2app(W_ComplexObject.descr_floordiv), + __rfloordiv__ = interp2app(W_ComplexObject.descr_rfloordiv), + __mod__ = interp2app(W_ComplexObject.descr_mod), + __rmod__ = interp2app(W_ComplexObject.descr_rmod), + __divmod__ = interp2app(W_ComplexObject.descr_divmod), + __rdivmod__ = interp2app(W_ComplexObject.descr_rdivmod), __pow__ = interp2app(W_ComplexObject.descr_pow), __rpow__ = interp2app(W_ComplexObject.descr_rpow), _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit