diff options
author | Tim Peters <tim.peters@gmail.com> | 2002-11-12 22:08:10 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2002-11-12 22:08:10 (GMT) |
commit | b9099c3df495d4bf0090d7a751325343852b61db (patch) | |
tree | 02605a750bc4b07c663d01ee61cc75755ab26c67 /Doc | |
parent | 4b9ed2f346921353b34a99332d9efd6ddce3a28b (diff) | |
download | cpython-b9099c3df495d4bf0090d7a751325343852b61db.zip cpython-b9099c3df495d4bf0090d7a751325343852b61db.tar.gz cpython-b9099c3df495d4bf0090d7a751325343852b61db.tar.bz2 |
SF patch 637176: list.sort crasher
Armin Rigo's Draconian but effective fix for
SF bug 453523: list.sort crasher
slightly fiddled to catch more cases of list mutation. The dreaded
internal "immutable list type" is gone! OTOH, if you look at a list
*while* it's being sorted now, it will appear to be empty. Better
than a core dump.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libstdtypes.tex | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Doc/lib/libstdtypes.tex b/Doc/lib/libstdtypes.tex index 49cb67b..3e788bb 100644 --- a/Doc/lib/libstdtypes.tex +++ b/Doc/lib/libstdtypes.tex @@ -922,7 +922,7 @@ The following operations are defined on mutable sequence types (where \lineiii{\var{s}.reverse()} {reverses the items of \var{s} in place}{(6)} \lineiii{\var{s}.sort(\optional{\var{cmpfunc}})} - {sort the items of \var{s} in place}{(6), (7), (8)} + {sort the items of \var{s} in place}{(6), (7), (8), (9)} \end{tableiii} \indexiv{operations on}{mutable}{sequence}{types} \indexiii{operations on}{sequence}{types} @@ -980,6 +980,12 @@ Notes: Python 2.2. The C implementation of Python 2.3 introduced a stable \method{sort()} method, but code that intends to be portable across implementations and versions must not rely on stability. + +\item[(9)] While a list is being sorted, the effect of attempting to + mutate, or even inspect, the list is undefined. The C implementation + of Python 2.3 makes the list appear empty for the duration, and raises + \exception{ValueError} if it can detect that the list has been + mutated during a sort. \end{description} |