Automatically audit use of a specific (set of) module(s)?

Hello.

I’m looking at some CPython code that uses pygit2, and indirectly libgit2.

The python process is SIGABRT’ing, which is a little scary.

In the interest of producing an SSCCE, is there a way, short of modifying pygit2 or our code, to log all the interactions our code has with pygit2 (or other module - perhaps something generic)? It feels like that would be a useful debugging tool, so maybe it already exists.

I may end up using valgrind, or I may even write a python wrapper around git(1) to replace pygit2. But I’d prefer to stick with pygit2 if it’s looking viable.

Thanks!