File tree 5 files changed +10
-7
lines changed
5 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ def test_repr(self):
64
64
@skip_emscripten_stack_overflow ()
65
65
def test_repr_deep (self ):
66
66
a = self .type2test ([])
67
- for i in range (100_000 ):
67
+ for i in range (150_000 ):
68
68
a = self .type2test ([a ])
69
69
self .assertRaises (RecursionError , repr , a )
70
70
Original file line number Diff line number Diff line change @@ -2628,7 +2628,7 @@ def adjust_int_max_str_digits(max_digits):
2628
2628
2629
2629
def exceeds_recursion_limit ():
2630
2630
"""For recursion tests, easily exceeds default recursion limit."""
2631
- return 100_000
2631
+ return 150_000
2632
2632
2633
2633
2634
2634
# Windows doesn't have os.uname() but it doesn't support s390x.
Original file line number Diff line number Diff line change @@ -755,7 +755,7 @@ def next(self):
755
755
@skip_wasi_stack_overflow ()
756
756
@skip_emscripten_stack_overflow ()
757
757
def test_ast_recursion_limit (self ):
758
- crash_depth = 200_000
758
+ crash_depth = 300_000
759
759
success_depth = 200
760
760
if _testinternalcapi is not None :
761
761
remaining = _testinternalcapi .get_c_recursion_remaining ()
Original file line number Diff line number Diff line change @@ -714,8 +714,8 @@ def test_yet_more_evil_still_undecodable(self):
714
714
def test_compiler_recursion_limit (self ):
715
715
# Compiler frames are small
716
716
limit = 100
717
- fail_depth = limit * 1000
718
- crash_depth = limit * 2000
717
+ fail_depth = limit * 1500
718
+ crash_depth = limit * 3000
719
719
success_depth = limit
720
720
721
721
def check_limit (prefix , repeated , mode = "single" ):
Original file line number Diff line number Diff line change @@ -360,23 +360,26 @@ _Py_InitializeRecursionLimits(PyThreadState *tstate)
360
360
_tstate -> c_stack_hard_limit = ((uintptr_t )low ) + guarantee + PYOS_STACK_MARGIN_BYTES ;
361
361
_tstate -> c_stack_soft_limit = _tstate -> c_stack_hard_limit + PYOS_STACK_MARGIN_BYTES ;
362
362
#else
363
+ char here ;
364
+ uintptr_t here_addr = (uintptr_t )& here ;
363
365
# if defined(HAVE_PTHREAD_GETATTR_NP )
364
366
size_t stack_size , guard_size ;
365
367
void * stack_addr ;
366
368
pthread_attr_t attr ;
367
369
int err = pthread_getattr_np (pthread_self (), & attr );
368
370
err |= pthread_attr_getguardsize (& attr , & guard_size );
369
371
err |= pthread_attr_getstack (& attr , & stack_addr , & stack_size );
372
+ err |= pthread_attr_destroy (& attr );
370
373
if (err == 0 ) {
371
374
uintptr_t base = ((uintptr_t )stack_addr ) + guard_size ;
372
375
_tstate -> c_stack_top = base + stack_size ;
373
376
_tstate -> c_stack_soft_limit = base + PYOS_STACK_MARGIN_BYTES * 2 ;
374
377
_tstate -> c_stack_hard_limit = base + PYOS_STACK_MARGIN_BYTES ;
378
+ assert (_tstate -> c_stack_soft_limit < here_addr );
379
+ assert (here_addr < _tstate -> c_stack_top );
375
380
return ;
376
381
}
377
382
# endif
378
- char here ;
379
- uintptr_t here_addr = (uintptr_t )& here ;
380
383
_tstate -> c_stack_top = _Py_SIZE_ROUND_UP (here_addr , 4096 );
381
384
_tstate -> c_stack_soft_limit = _tstate -> c_stack_top - Py_C_STACK_SIZE ;
382
385
_tstate -> c_stack_hard_limit = _tstate -> c_stack_top - (Py_C_STACK_SIZE + PYOS_STACK_MARGIN_BYTES );
You can’t perform that action at this time.
0 commit comments