diff options
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r-- | Modules/_testcapimodule.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index ee6f02d..dec64af 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -44,16 +44,8 @@ // Several parts of this module are broken out into files in _testcapi/. // Include definitions from there. #include "_testcapi/parts.h" +#include "_testcapi/util.h" -#define NULLABLE(x) do { if (x == Py_None) x = NULL; } while (0); - -#define RETURN_INT(value) do { \ - int _ret = (value); \ - if (_ret == -1) { \ - return NULL; \ - } \ - return PyLong_FromLong(_ret); \ - } while (0) // Forward declarations static struct PyModuleDef _testcapimodule; @@ -1348,19 +1340,13 @@ static PyObject * test_PyBuffer_SizeFromFormat(PyObject *self, PyObject *args) { const char *format; - Py_ssize_t result; if (!PyArg_ParseTuple(args, "s:test_PyBuffer_SizeFromFormat", &format)) { return NULL; } - result = PyBuffer_SizeFromFormat(format); - if (result == -1) { - return NULL; - } - - return PyLong_FromSsize_t(result); + RETURN_SIZE(PyBuffer_SizeFromFormat(format)); } /* Test that the fatal error from not having a current thread doesn't |