Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Closed
Description
Bug report
Bug description:
I mentioned regex but this probably applies to other modules as well. In the code below, if the# line right after the findall is commented out (as it is right now), the code raises the exception past the try-except block on theprint("Safely reached EOF.") statement. The exception happens one statement later than expected. NB: I tested all Python versions on Windows but only 3.11 on Linux.
import_thread,refromthreadingimportTimers="ab"*20000000pattern=re.compile("ab+")Timer(0.2,_thread.interrupt_main).start()try:pattern.findall(s)# print() ###################################################################except:print("Exception block")print("Safely reached EOF.")
CPython versions tested on:
3.9, 3.10, 3.11, 3.12, CPython main branch
Operating systems tested on:
Linux, Windows