hpyproject / hpy

HPy: a better API for Python
https://hpyproject.org
MIT License
1.1k stars 53 forks source link

Provide better diagnostics for the debug mode #267

Open steve-s opened 2 years ago

steve-s commented 2 years ago

At this point, if HPy detects an issue in the debug mode, it prints a generic message and aborts the process(*).

It should provide more context to help with debugging of the issue, i.e., "diagnostics output":

Implementation:

(*) In case of the mmap based raw data protection mechanism (#259), it just segfaults, which we should improve by registering a handler and then we can provide the same diagnostics there too.

steve-s commented 2 years ago

We can start by defining some simple internal abstraction: report_invalid_handle(handle), and some basic implementation that would use backtrace where available and print some generic message otherwise. This should be fairly simple and would already provide some nice improvement.