
On Thu, 17 Feb 2022 at 08:33, J.B. Langston <jblangston@datastax.com> wrote:
Well, I certainly sparked a lot of interesting discussion, which I have quite enjoyed reading. But to bring this thread back around to its original topic, is there support among the Python maintainers for adding a timeout feature to the Python re library? I will look at the third-party regex library that Jonathan suggested but I still believe a timeout option would be a valuable feature to have in the standard library.
I'm not a maintainer, but I'd personally be against a timeout. It would add overhead to common cases in order to put a shield around pathological ones, and it's difficult to impossible to usefully define the cutoff. Instead, I'd recommend trying some of the simpler parsing options, as explored in the ensuing discussion, to see if one of those has better worst-case performance while still being able to do what's needed. (Hence all the discussion of "no-backtracking" options.) ChrisA