[issue846388] Check for signals during regular expression matches
Ralf Schmitt
report at bugs.python.org
Fri Nov 2 22:35:40 CET 2007
Ralf Schmitt added the comment:
I'm attaching a working patch against 2.5.1 and a short test program.
#! /usr/bin/env python
import signal
import re
import time
def main():
num=28 # need more than 60s on a 2.4Ghz core 2
r=re.compile("a?"*num+"a"*num)
signal.signal(signal.SIGALRM, signal.default_int_handler)
signal.alarm(1)
stime = time.time()
try:
r.match("a"*num)
except KeyboardInterrupt:
assert time.time()-stime<3
else:
raise RuntimeError("no keyboard interrupt")
if __name__=='__main__':
main()
Added file: http://bugs.python.org/file8679/patch
____________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue846388>
____________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: application/octet-stream
Size: 1044 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-bugs-list/attachments/20071102/0dd1d420/attachment.obj
More information about the Python-bugs-list
mailing list