Fix ctypes.set_errno for gcc.
authorThomas Heller <theller@ctypes.org>
Wed, 4 Jun 2008 19:19:00 +0000 (19:19 +0000)
committerThomas Heller <theller@ctypes.org>
Wed, 4 Jun 2008 19:19:00 +0000 (19:19 +0000)
Modules/_ctypes/callproc.c

index 70ca73f10a03e3d2b485754702364587376d63b0..aa297af7b3e3e7b8f28b2aa2a8b971a112092ddc 100644 (file)
@@ -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