diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2015-06-23 12:38:13 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2015-06-23 12:38:13 (GMT) |
commit | a72f0cdaea847228aceb5b56fbd28b77ef4809c4 (patch) | |
tree | ae80fc12096a3e2dd5989b74a2916e7c856ede58 /Modules/_testcapimodule.c | |
parent | 5376ba9630e45ad177150ae68c9712640330a2fc (diff) | |
parent | 6bc217dd3d43763e62b413e75ddaeb7d30e1b451 (diff) | |
download | cpython-a72f0cdaea847228aceb5b56fbd28b77ef4809c4.zip cpython-a72f0cdaea847228aceb5b56fbd28b77ef4809c4.tar.gz cpython-a72f0cdaea847228aceb5b56fbd28b77ef4809c4.tar.bz2 |
Issue #24489: ensure a previously set C errno doesn't disturb cmath.polar().
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r-- | Modules/_testcapimodule.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 2697ac2..ba0a24b 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -1796,6 +1796,18 @@ raise_exception(PyObject *self, PyObject *args) } 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) { PyObject *orig_exc; @@ -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}, |