In an effort to find a non-blocking, minimally intrusive, replacement for the signal method of making a mid-function timeout, I stumbled upon this

dr-luke / PyTimeoutAfter

submited by
Style Pass
2021-07-13 16:30:03

In an effort to find a non-blocking, minimally intrusive, replacement for the signal method of making a mid-function timeout, I stumbled upon this "Nasty hack" posted by liuw on GitHub, which allowed me to actual do what I originally though was impossible.

As LIU points out, this is a NASTY hack and is only possible by breaking the C level interpreter to allow this to happen. This can be a point of concern and my be fixed in the future, but as for now it seems safe to use with the current version of python 3 (Tested on 3.6.5 - 3.8.0)

Leave a Comment
Related Posts