summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-01-14 03:31:43 (GMT)
committerGuido van Rossum <guido@python.org>2007-01-14 03:31:43 (GMT)
commitddefaf31b366ea84250fc5090837c2b764a04102 (patch)
treeab3d7b5172f4e6a064165468fc70beb41bdca1d3 /Modules/socketmodule.c
parent5b787e8bc2dbda5583eee039cb6a6e47c8d8a034 (diff)
downloadcpython-ddefaf31b366ea84250fc5090837c2b764a04102.zip
cpython-ddefaf31b366ea84250fc5090837c2b764a04102.tar.gz
cpython-ddefaf31b366ea84250fc5090837c2b764a04102.tar.bz2
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.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 8ec0ed7..31efa0a 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -3483,12 +3483,7 @@ socket_ntohl(PyObject *self, PyObject *arg)
{
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 @@ socket_htonl(PyObject *self, PyObject *arg)
{
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 @@ socket_getaddrinfo(PyObject *self, PyObject *args)
"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)) {