Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 40626:4aee3f672f77
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.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Sun, 14 Jan 2007 03:31:43 +0000 |
| parents | 67287ca4e1e8 |
| children | 86ce1df6a88e |
line wrap: on
line diff
--- a/Modules/socketmodule.c Sat Jan 13 23:54:39 2007 +0000 +++ b/Modules/socketmodule.c Sun Jan 14 03:31:43 2007 +0000 @@ -3483,12 +3483,7 @@ { unsigned long x; - if (PyInt_Check(arg)) { - x = PyInt_AS_LONG(arg); - if (x == (unsigned long) -1 && PyErr_Occurred()) - return NULL; - } - else if (PyLong_Check(arg)) { + if (PyLong_Check(arg)) { x = PyLong_AsUnsignedLong(arg); if (x == (unsigned long) -1 && PyErr_Occurred()) return NULL; @@ -3542,12 +3537,7 @@ { unsigned long x; - if (PyInt_Check(arg)) { - x = PyInt_AS_LONG(arg); - if (x == (unsigned long) -1 && PyErr_Occurred()) - return NULL; - } - else if (PyLong_Check(arg)) { + if (PyLong_Check(arg)) { x = PyLong_AsUnsignedLong(arg); if (x == (unsigned long) -1 && PyErr_Occurred()) return NULL; @@ -3827,7 +3817,7 @@ "getaddrinfo() argument 1 must be string or None"); return NULL; } - if (PyInt_Check(pobj)) { + if (PyInt_CheckExact(pobj)) { PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", PyInt_AsLong(pobj)); pptr = pbuf; } else if (PyString_Check(pobj)) {
