]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport gvanrossum's patch:
authorAnthony Baxter <anthonybaxter@gmail.com>
Thu, 18 Apr 2002 05:37:51 +0000 (05:37 +0000)
committerAnthony Baxter <anthonybaxter@gmail.com>
Thu, 18 Apr 2002 05:37:51 +0000 (05:37 +0000)
SF bug #543387.

Complex numbers implement divmod() and //, neither of which makes one
lick of sense.  Unfortunately this is documented, so I'm adding a
deprecation warning now, so we can delete this silliness, oh, around
2005 or so.

Bugfix candidate (At least for 2.2.2, I think.)

Original patches were:
python/dist/src/Objects/complexobject.c:2.58

Objects/complexobject.c

index 8392f5d80d364a5cc45b929a55f17a378ad3a801..5e4654622ba7a5be86778f3c5d527a98e1ef1223 100644 (file)
@@ -418,6 +418,11 @@ complex_divmod(PyComplexObject *v, PyComplexObject *w)
 {
         Py_complex div, mod;
        PyObject *d, *m, *z;
+
+       if (PyErr_Warn(PyExc_DeprecationWarning,
+                      "complex divmod() and // are deprecated") < 0)
+               return NULL;
+
        errno = 0;
        div = c_quot(v->cval,w->cval); /* The raw divisor value. */
        if (errno == EDOM) {