Fix ctypes.set_errno for gcc.

This commit is contained in:
Thomas Heller 2008-06-04 19:19:00 +00:00
parent e70c3378c0
commit 8f22b88e28
1 changed files with 4 additions and 2 deletions

View 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