This repository has been archived by the owner on Jan 8, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff9e3ee
commit d4892aa
Showing
3 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
dev-lang/python/files/python-2.7.9-Fix-merge_collapse-of-Timsort.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
From 2bbb9cc6136ba73da558e7dfd79df3787fbc30fc Mon Sep 17 00:00:00 2001 | ||
From: Stijn de Gouw <info@envisage-project.eu> | ||
Date: Tue, 24 Feb 2015 15:53:25 +0100 | ||
Subject: [PATCH] Fix merge_collapse() of Timsort. | ||
|
||
--- | ||
Objects/listobject.c | 3 ++- | ||
1 file changed, 2 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/Objects/listobject.c b/Objects/listobject.c | ||
index f753643..94fc5e7 100644 | ||
--- a/Objects/listobject.c | ||
+++ b/Objects/listobject.c | ||
@@ -1800,7 +1800,8 @@ merge_collapse(MergeState *ms) | ||
assert(ms); | ||
while (ms->n > 1) { | ||
Py_ssize_t n = ms->n - 2; | ||
- if (n > 0 && p[n-1].len <= p[n].len + p[n+1].len) { | ||
+ if ( n > 0 && p[n-1].len <= p[n].len + p[n+1].len | ||
+ || (n-1 > 0 && p[n-2].len <= p[n].len + p[n-1].len)) { | ||
if (p[n-1].len < p[n+1].len) | ||
--n; | ||
if (merge_at(ms, n) < 0) | ||
-- | ||
2.0.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters