This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients serhiy.storchaka, vstinner, xdegaye
Date 2017-06-19.12:31:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1497875519.76.0.325450022219.issue30695@psf.upfronthosting.co.za>
In-reply-to
Content
The main difference between your change and pyfailmalloc is the ability in pyfailmalloc to only fail in N allocations. If you want to test various code paths, you need to allow N allocations to reach the deep code that you want to test.

My code is something like 100 lines of C code.
https://bitbucket.org/haypo/pyfailmalloc/src/cdaf3609a30b88243d04e79d6074f3b28d9b64e3/failmalloc.c?at=default&fileviewer=file-view-default

IMHO it's small enough to fit directly into _testcapi.

The question is more what do you want to do with it? It was proposed to "include" pyfailmalloc directly in the Python test suite. Maybe add an option to enable it?

I ran the Python test suite with pyfailmalloc in gdb using this script:
https://bitbucket.org/haypo/pyfailmalloc/src/cdaf3609a30b88243d04e79d6074f3b28d9b64e3/debug_cpython.gdb?at=default&fileviewer=file-view-default

./python -m test -F -r -v -x test_tracemalloc

I waited for the next *crash* and ignored all expected tests failing with MemoryError. --forever (-F) is nice to run random tests until you get a crash.
History
Date User Action Args
2017-06-19 12:31:59vstinnersetrecipients: + vstinner, xdegaye, serhiy.storchaka
2017-06-19 12:31:59vstinnersetmessageid: <1497875519.76.0.325450022219.issue30695@psf.upfronthosting.co.za>
2017-06-19 12:31:59vstinnerlinkissue30695 messages
2017-06-19 12:31:59vstinnercreate