From: Thomas Heller Date: Wed, 4 Jun 2008 19:19:00 +0000 (+0000) Subject: Fix ctypes.set_errno for gcc. X-Git-Tag: v2.6b1~160 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8f22b88e28bbb2ea9255592d3ac12e2623bc51e8;p=thirdparty%2FPython%2Fcpython.git Fix ctypes.set_errno for gcc. --- diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index 70ca73f10a03..aa297af7b3e3 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -197,10 +197,12 @@ get_errno(PyObject *self, PyObject *args) static PyObject * set_errno(PyObject *self, PyObject *args) { - int new_errno; + int new_errno, prev_errno; if (!PyArg_ParseTuple(args, "i", &new_errno)) return NULL; - return PyInt_FromLong(_save_errno(new_errno)); + prev_errno = ctypes_errno; + ctypes_errno = new_errno; + return PyInt_FromLong(prev_errno); } #else