comparison Objects/complexobject.c @ 23150:52257affe0c9 2.2

backport gvanrossum's patch: Deprecate % as well. The message for deprecation of //, % and divmod is the same in all three cases (mostly because // calls divmod :-). Original patches were: python/dist/src/Objects/complexobject.c:2.59
author Anthony Baxter <anthonybaxter@gmail.com>
date Thu, 18 Apr 2002 05:39:54 +0000
parents c4609ca17e3e
children 2911eb377266
comparison
equal deleted inserted replaced
23149:62fabbd457be 23150:52257affe0c9
397 397
398 static PyObject * 398 static PyObject *
399 complex_remainder(PyComplexObject *v, PyComplexObject *w) 399 complex_remainder(PyComplexObject *v, PyComplexObject *w)
400 { 400 {
401 Py_complex div, mod; 401 Py_complex div, mod;
402
403 if (PyErr_Warn(PyExc_DeprecationWarning,
404 "complex divmod(), // and % are deprecated") < 0)
405 return NULL;
406
402 errno = 0; 407 errno = 0;
403 div = c_quot(v->cval,w->cval); /* The raw divisor value. */ 408 div = c_quot(v->cval,w->cval); /* The raw divisor value. */
404 if (errno == EDOM) { 409 if (errno == EDOM) {
405 PyErr_SetString(PyExc_ZeroDivisionError, "complex remainder"); 410 PyErr_SetString(PyExc_ZeroDivisionError, "complex remainder");
406 return NULL; 411 return NULL;
418 { 423 {
419 Py_complex div, mod; 424 Py_complex div, mod;
420 PyObject *d, *m, *z; 425 PyObject *d, *m, *z;
421 426
422 if (PyErr_Warn(PyExc_DeprecationWarning, 427 if (PyErr_Warn(PyExc_DeprecationWarning,
423 "complex divmod() and // are deprecated") < 0) 428 "complex divmod(), // and % are deprecated") < 0)
424 return NULL; 429 return NULL;
425 430
426 errno = 0; 431 errno = 0;
427 div = c_quot(v->cval,w->cval); /* The raw divisor value. */ 432 div = c_quot(v->cval,w->cval); /* The raw divisor value. */
428 if (errno == EDOM) { 433 if (errno == EDOM) {