summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-12-02 09:56:21 (GMT)
committerGuido van Rossum <guido@python.org>2002-12-02 09:56:21 (GMT)
commitbb48465273d2aa98fc7669e99b0d5fb1c57962de (patch)
tree998d5fbda5720bc7a50988b335f4f28f1d37ecb1
parent5f7c4b34b91171da1755af9b6bf69eda07b811aa (diff)
downloadcpython-bb48465273d2aa98fc7669e99b0d5fb1c57962de.zip
cpython-bb48465273d2aa98fc7669e99b0d5fb1c57962de.tar.gz
cpython-bb48465273d2aa98fc7669e99b0d5fb1c57962de.tar.bz2
On Max OSX, try increasing the stack limit to 2048 so test_re and
test_sre won't die with a SegFault.
-rwxr-xr-xLib/test/regrtest.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 1590ab1..ffb49ab 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -83,6 +83,22 @@ if sys.maxint > 0x7fffffff:
warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning,
"<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
RESOURCE_NAMES = ('curses', 'largefile', 'network', 'bsddb')