diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-08-16 16:11:03 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-08-16 16:11:03 (GMT) |
commit | 0067bd68c979e88b96e8eb5001d0e184ea949bb0 (patch) | |
tree | c15748690621cfb43a977137ab5f4e39d86c3de3 /Modules | |
parent | 72dc1eadd918dc9ddd6a30149d90617d706a0b19 (diff) | |
download | cpython-0067bd68c979e88b96e8eb5001d0e184ea949bb0.zip cpython-0067bd68c979e88b96e8eb5001d0e184ea949bb0.tar.gz cpython-0067bd68c979e88b96e8eb5001d0e184ea949bb0.tar.bz2 |
add _testcapi.raise_memoryerror to make test_exceptions.test_MemoryError simpler
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_testcapimodule.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 3ee3bf4..494937a 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -971,8 +971,19 @@ exception_print(PyObject *self, PyObject *args) + +/* reliably raise a MemoryError */ +static PyObject * +raise_memoryerror(PyObject *self) +{ + PyErr_NoMemory(); + return NULL; +} + + static PyMethodDef TestMethods[] = { {"raise_exception", raise_exception, METH_VARARGS}, + {"raise_memoryerror", (PyCFunction)raise_memoryerror, METH_NOARGS}, {"test_config", (PyCFunction)test_config, METH_NOARGS}, {"test_list_api", (PyCFunction)test_list_api, METH_NOARGS}, {"test_dict_iteration", (PyCFunction)test_dict_iteration,METH_NOARGS}, |