Issue #24489: ensure a previously set C errno doesn't disturb cmath.polar().

This commit is contained in:
Antoine Pitrou 2015-06-23 14:38:13 +02:00
commit a72f0cdaea
4 changed files with 58 additions and 11 deletions

View file

@ -1795,6 +1795,18 @@ raise_exception(PyObject *self, PyObject *args)
return NULL;
}
static PyObject *
set_errno(PyObject *self, PyObject *args)
{
int new_errno;
if (!PyArg_ParseTuple(args, "i:set_errno", &new_errno))
return NULL;
errno = new_errno;
Py_RETURN_NONE;
}
static PyObject *
test_set_exc_info(PyObject *self, PyObject *args)
{
@ -3510,6 +3522,7 @@ test_PyTime_AsMicroseconds(PyObject *self, PyObject *args)
static PyMethodDef TestMethods[] = {
{"raise_exception", raise_exception, METH_VARARGS},
{"raise_memoryerror", (PyCFunction)raise_memoryerror, METH_NOARGS},
{"set_errno", set_errno, METH_VARARGS},
{"test_config", (PyCFunction)test_config, METH_NOARGS},
{"test_sizeof_c_types", (PyCFunction)test_sizeof_c_types, METH_NOARGS},
{"test_datetime_capi", test_datetime_capi, METH_NOARGS},