File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8383 warnings .filterwarnings ("ignore" , "hex/oct constants" , FutureWarning ,
8484 "<string>" )
8585
86+ # MacOSX (a.k.a. Darwin) has a default stack size that is too small
87+ # for deeply recursive regular expressions. We see this as crashes in
88+ # the Python test suite when running test_re.py and test_sre.py. The
89+ # fix is to set the stack limit to 2048.
90+ # This approach may also be useful for other Unixy platforms that
91+ # suffer from small default stack limits.
92+ if sys .platform == 'darwin' :
93+ try :
94+ import resource
95+ except ImportError :
96+ pass
97+ else :
98+ soft , hard = resource .getrlimit (resource .RLIMIT_STACK )
99+ newsoft = min (hard , max (soft , 1024 * 2048 ))
100+ resource .setrlimit (resource .RLIMIT_STACK , (newsoft , hard ))
101+
86102from test import test_support
87103
88104RESOURCE_NAMES = ('curses' , 'largefile' , 'network' , 'bsddb' )
You can’t perform that action at this time.
0 commit comments