PEP-654: warn that leaf_generator recycles the tracebacks list (GH-2109)

This commit is contained in:
Irit Katriel 2021-10-16 21:53:04 +01:00 committed by GitHub
parent 42c420f24f
commit 27b8357bac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -469,7 +469,12 @@ recursively, as follows:
else:
# exc is a leaf exception and its traceback
# is the concatenation of the traceback
# segments in tbs
# segments in tbs.
# Note: the list returned (tbs) is reused in each iteration
# through the generator. Make a copy if your use case holds
# on to it beyond the current iteration or mutates its contents.
yield exc, tbs
tbs.pop()