3

I maintain a large C++ library which I have partially exposed to python using pybind11. The C++ library contains unit test which I run sometimes under various sanitizers: asan, tsan, etc. These tests run cleanly, but of course tests aren't perfect and you can't test 100% of all edge cases.

There's a particular jupyter notebook that crashes when I use this library with a certain settings, a particular dataset, and various options which could be replicated in a pure C++ environment, but that replication would be very labor intensive, time consuming, and error prone.

IF I had pure C++ in front of me I would run the notebook through ubsan, asan, etc to make sure I'm not witnessing undefined behavior or a segfault. Is there a way I can apply these sanitizers (or something equivalent) to my notebook without rewriting all the python glue in raw C++?

Steven Scott
  • 481
  • 3
  • 14
  • Maybe build python with asan, tsan, etc. and just run it with your module? – Osyotr Oct 19 '22 at 22:50
  • 1
    [This question](https://stackoverflow.com/questions/55692357/address-sanitizer-on-a-python-extension) may be helpful. – yugr Oct 20 '22 at 04:56
  • Valgrind does not require compilation with special options so it might be useful as well. – unddoch Oct 20 '22 at 10:32
  • Yugr pointed to the correct [solution](https://stackoverflow.com/questions/55692357/address-sanitizer-on-a-python-extension). Thank you. – Steven Scott Oct 20 '22 at 23:24

0 Answers0