[Python-checkins] python/dist/src/Lib/test regrtest.py,1.107,1.108

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
2002年12月02日 01:56:23 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv6867
Modified Files:
	regrtest.py 
Log Message:
On Max OSX, try increasing the stack limit to 2048 so test_re and
test_sre won't die with a SegFault.
Index: regrtest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v
retrieving revision 1.107
retrieving revision 1.108
diff -C2 -d -r1.107 -r1.108
*** regrtest.py	26 Nov 2002 21:40:59 -0000	1.107
--- regrtest.py	2 Dec 2002 09:56:21 -0000	1.108
***************
*** 84,87 ****
--- 84,103 ----
 "<string>")
 
+ # MacOSX (a.k.a. Darwin) has a default stack size that is too small
+ # for deeply recursive regular expressions. We see this as crashes in
+ # the Python test suite when running test_re.py and test_sre.py. The
+ # fix is to set the stack limit to 2048.
+ # This approach may also be useful for other Unixy platforms that
+ # suffer from small default stack limits.
+ if sys.platform == 'darwin':
+ try:
+ import resource
+ except ImportError:
+ pass
+ else:
+ soft, hard = resource.getrlimit(resource.RLIMIT_STACK)
+ newsoft = min(hard, max(soft, 1024*2048))
+ resource.setrlimit(resource.RLIMIT_STACK, (newsoft, hard))
+ 
 from test import test_support
 

AltStyle によって変換されたページ (->オリジナル) /