summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-08-29 07:57:59 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-08-29 07:57:59 (GMT)
commitca810467a4db78781c5e35100024cae779e954e5 (patch)
tree6f9bad18c0b52f59cafe039de83d8002018b8ba0 /Objects
parent378b2c9a037bccdbcaca32541c1baebb1a0de30a (diff)
downloadcpython-ca810467a4db78781c5e35100024cae779e954e5.zip
cpython-ca810467a4db78781c5e35100024cae779e954e5.tar.gz
cpython-ca810467a4db78781c5e35100024cae779e954e5.tar.bz2
Get rid of more coerce cruft (really check in this time :-)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/longobject.c18
-rw-r--r--Objects/object.c27
-rw-r--r--Objects/typeobject.c1
3 files changed, 1 insertions, 45 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index ab8a8d7..87082cb 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -3158,22 +3158,6 @@ long_or(PyObject *v, PyObject *w)
return c;
}
-static int
-long_coerce(PyObject **pv, PyObject **pw)
-{
- if (PyInt_Check(*pw)) {
- *pw = PyLong_FromLong(PyInt_AS_LONG(*pw));
- Py_INCREF(*pv);
- return 0;
- }
- else if (PyLong_Check(*pw)) {
- Py_INCREF(*pv);
- Py_INCREF(*pw);
- return 0;
- }
- return 1; /* Can't do it */
-}
-
static PyObject *
long_long(PyObject *v)
{
@@ -3330,7 +3314,7 @@ static PyNumberMethods long_as_number = {
long_and, /*nb_and*/
long_xor, /*nb_xor*/
long_or, /*nb_or*/
- long_coerce, /*nb_coerce*/
+ 0, /*nb_coerce*/
long_int, /*nb_int*/
long_long, /*nb_long*/
long_float, /*nb_float*/
diff --git a/Objects/object.c b/Objects/object.c
index 4fee2f0..e202e9b 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -1273,33 +1273,6 @@ PyObject_Not(PyObject *v)
return res == 0;
}
-/* Coerce two numeric types to the "larger" one.
- Increment the reference count on each argument.
- Return value:
- -1 if an error occurred;
- 0 if the coercion succeeded (and then the reference counts are increased);
- 1 if no coercion is possible (and no error is raised).
-*/
-int
-PyNumber_CoerceEx(PyObject **pv, PyObject **pw)
-{
- register PyObject *v = *pv;
- register PyObject *w = *pw;
- int res;
-
- if (v->ob_type->tp_as_number && v->ob_type->tp_as_number->nb_coerce) {
- res = (*v->ob_type->tp_as_number->nb_coerce)(pv, pw);
- if (res <= 0)
- return res;
- }
- if (w->ob_type->tp_as_number && w->ob_type->tp_as_number->nb_coerce) {
- res = (*w->ob_type->tp_as_number->nb_coerce)(pw, pv);
- if (res <= 0)
- return res;
- }
- return 1;
-}
-
/* Test whether an object can be called */
int
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index d16c6b4..074fad9 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2935,7 +2935,6 @@ inherit_slots(PyTypeObject *type, PyTypeObject *base)
COPYNUM(nb_and);
COPYNUM(nb_xor);
COPYNUM(nb_or);
- COPYNUM(nb_coerce);
COPYNUM(nb_int);
COPYNUM(nb_long);
COPYNUM(nb_float);