[Python-checkins] r88643 - python/branches/py3k/Modules/posixmodule.c

antoine.pitrou python-checkins at python.org
Sat Feb 26 14:38:36 CET 2011


Author: antoine.pitrou
Date: Sat Feb 26 14:38:35 2011
New Revision: 88643

Log:
Check error return from _parse_off_t(), and remove cruft from the 2->3 transition.



Modified:
   python/branches/py3k/Modules/posixmodule.c

Modified: python/branches/py3k/Modules/posixmodule.c
==============================================================================
--- python/branches/py3k/Modules/posixmodule.c	(original)
+++ python/branches/py3k/Modules/posixmodule.c	Sat Feb 26 14:38:35 2011
@@ -369,8 +369,7 @@
 #if !defined(HAVE_LARGEFILE_SUPPORT)
     *((off_t*)addr) = PyLong_AsLong(arg);
 #else
-    *((off_t*)addr) = PyLong_Check(arg) ? PyLong_AsLongLong(arg)
-            : PyLong_AsLong(arg);
+    *((off_t*)addr) = PyLong_AsLongLong(arg);
 #endif
     if (PyErr_Occurred())
         return 0;
@@ -5772,8 +5771,7 @@
 #if !defined(HAVE_LARGEFILE_SUPPORT)
     pos = PyLong_AsLong(posobj);
 #else
-    pos = PyLong_Check(posobj) ?
-        PyLong_AsLongLong(posobj) : PyLong_AsLong(posobj);
+    pos = PyLong_AsLongLong(posobj);
 #endif
     if (PyErr_Occurred())
         return NULL;
@@ -6030,7 +6028,8 @@
         return Py_BuildValue("nO", ret, Py_None);
     }
 #endif
-    _parse_off_t(offobj, &offset);
+    if (!_parse_off_t(offobj, &offset))
+        return NULL;
     Py_BEGIN_ALLOW_THREADS
     ret = sendfile(out, in, &offset, count);
     Py_END_ALLOW_THREADS


More information about the Python-checkins mailing list