3 ms·
This is probably not a good idea. (dutc = Don't Use This Code) It's horrible that it even works. It's surprising how well it works when it does work. It was
by jamesdutc 12y ago
This is probably not a good idea. (dutc = Don't Use This Code)
It's horrible that it even works.
It's surprising how well it works when it does work.
It was a great opportunity to solidify some knowledge about low-level (implementation) details.
- maxerickson 12y agoSince you mention thinking there must be a better way in hook.c, you can override the traceback printer: https://docs.python.org/3.4/library/sys.html#sys.excepthook https://docs.python.org/3.4/library/sys.html#sys.excepthook I haven't thought through how to access the state needed to make a suggestion though.
- jamesdutc 12y agoYeah, that was one of the (less-bad) approaches I tried first: https://gist.github.com/dutc/3f2c79048d95287be138 https://gist.github.com/dutc/3f2c79048d95287be138 But you can see it's somewhat limited. And I was curious to actually hook an internal Python call! By the way, that hook.c comment was wondering whether there might be a nicer (more nearly portable?) way to set-up these assembly sections. Some of this stuff was hacked together, but I have a couple other games I want to play with this gimmick, and I want to make the hooking a bit better. https://github.com/dutc/libhook https://github.com/dutc/libhook