Merged the int/long unification branch, by very crude means (sorry Thomas!).

I banged on the code (beyond what's in that branch) to make fewer tests fail;
the only tests that fail now are:
  test_descr -- can't pickle ints?!
  test_pickletools -- ???
  test_socket -- See python.org/sf/1619659
  test_sqlite -- ???
I'll deal with those later.
This commit is contained in:
Guido van Rossum 2007-01-14 03:31:43 +00:00
parent 5b787e8bc2
commit ddefaf31b3
46 changed files with 798 additions and 404 deletions

View file

@ -273,10 +273,7 @@ convert_to_double(PyObject **v, double *dbl)
{
register PyObject *obj = *v;
if (PyInt_Check(obj)) {
*dbl = (double)PyInt_AS_LONG(obj);
}
else if (PyLong_Check(obj)) {
if (PyLong_Check(obj)) {
*dbl = PyLong_AsDouble(obj);
if (*dbl == -1.0 && PyErr_Occurred()) {
*v = NULL;
@ -376,32 +373,6 @@ float_richcompare(PyObject *v, PyObject *w, int op)
goto Unimplemented;
}
else if (PyInt_Check(w)) {
long jj = PyInt_AS_LONG(w);
/* In the worst realistic case I can imagine, C double is a
* Cray single with 48 bits of precision, and long has 64
* bits.
*/
#if SIZEOF_LONG > 6
unsigned long abs = (unsigned long)(jj < 0 ? -jj : jj);
if (abs >> 48) {
/* Needs more than 48 bits. Make it take the
* PyLong path.
*/
PyObject *result;
PyObject *ww = PyLong_FromLong(jj);
if (ww == NULL)
return NULL;
result = float_richcompare(v, ww, op);
Py_DECREF(ww);
return result;
}
#endif
j = (double)jj;
assert((long)j == jj);
}
else if (PyLong_Check(w)) {
int vsign = i == 0.0 ? 0 : i < 0.0 ? -1 : 1;
int wsign = _PyLong_Sign(w);