File tree 3 files changed +7
-4
lines changed
3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -435,15 +435,15 @@ def gc_callback(phase, info):
435
435
_gc_start = now
436
436
elif phase == "stop" and _gc_start > 0 :
437
437
_gc_cumulative_time += now - _gc_start
438
- except RecursionError :
438
+ except RecursionError : # pragma: no cover
439
439
# Avoid flakiness via UnraisableException, which is caught and
440
440
# warned by pytest. The actual callback (this function) is
441
441
# validated to never trigger a RecursionError itself when
442
442
# when called by gc.collect.
443
443
# Anyway, we should hit the same error on "start"
444
444
# and "stop", but to ensure we don't get out of sync we just
445
445
# signal that there is no matching start.
446
- _gc_start = - 1
446
+ _gc_start = 0
447
447
return
448
448
449
449
gc .callbacks .insert (0 , gc_callback )
Original file line number Diff line number Diff line change @@ -87,9 +87,12 @@ def get_trimmed_traceback(exception=None):
87
87
else :
88
88
tb = exception .__traceback__
89
89
# Avoid trimming the traceback if we're in verbose mode, or the error
90
- # was raised inside Hypothesis
90
+ # was raised inside Hypothesis. Additionally, the environment variable
91
+ # HYPOTHESIS_NO_TRACEBACK_TRIM is respected if nonempty, because verbose
92
+ # mode is prohibitively slow when debugging strategy recursion errors.
91
93
if (
92
94
tb is None
95
+ or os .environ .get ("HYPOTHESIS_NO_TRACEBACK_TRIM" , None )
93
96
or hypothesis .settings .default .verbosity >= hypothesis .Verbosity .debug
94
97
or is_hypothesis_file (traceback .extract_tb (tb )[- 1 ][0 ])
95
98
and not isinstance (exception , _Trimmable )
Original file line number Diff line number Diff line change @@ -216,7 +216,7 @@ def gen_cycles():
216
216
# of reference cycles, to trigger GC (if enabled). Beware: there may not
217
217
# even be room for raising new exceptions here, anything will end up as
218
218
# a RecursionError.
219
- for i in range (NUM_CYCLES ):
219
+ for _ in range (NUM_CYCLES ):
220
220
a = [None ]
221
221
b = [a ]
222
222
a [0 ] = b
You can’t perform that action at this time.
0 commit comments