Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 24380:672843ee4b61 legacy-trunk
Put checks for error returns in the right place.
| author | Jeremy Hylton <jeremy@alum.mit.edu> |
|---|---|
| date | Thu, 25 Jul 2002 16:37:51 +0000 |
| parents | 89ce62126664 |
| children | 8e266d0acd10 |
line wrap: on
line diff
--- a/Modules/socketmodule.c Thu Jul 25 16:23:21 2002 +0000 +++ b/Modules/socketmodule.c Thu Jul 25 16:37:51 2002 +0000 @@ -2475,9 +2475,13 @@ if (PyInt_Check(arg)) { x = PyInt_AS_LONG(arg); + if (x == (unsigned long) -1 && PyErr_Occurred()) + return NULL; } else if (PyLong_Check(arg)) { x = PyLong_AsUnsignedLong(arg); + if (x == (unsigned long) -1 && PyErr_Occurred()) + return NULL; #if SIZEOF_LONG > 4 { unsigned long y; @@ -2530,9 +2534,13 @@ if (PyInt_Check(arg)) { x = PyInt_AS_LONG(arg); + if (x == (unsigned long) -1 && PyErr_Occurred()) + return NULL; } else if (PyLong_Check(arg)) { x = PyLong_AsUnsignedLong(arg); + if (x == (unsigned long) -1 && PyErr_Occurred()) + return NULL; #if SIZEOF_LONG > 4 { unsigned long y; @@ -2549,8 +2557,6 @@ return PyErr_Format(PyExc_TypeError, "expected int/long, %s found", arg->ob_type->tp_name); - if (x == (unsigned long) -1 && PyErr_Occurred()) - return NULL; return PyInt_FromLong(htonl(x)); }
