summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-06-16 01:42:40 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-06-16 01:42:40 (GMT)
commit305480c9dcec736cba91db62062f75b5ceff9b60 (patch)
tree559504eba3446a11a6ad5d943a9d97f6f015783d /Python
parenta161f6070b455ac43aa4e414d7b64e6a80a37978 (diff)
downloadcpython-305480c9dcec736cba91db62062f75b5ceff9b60.zip
cpython-305480c9dcec736cba91db62062f75b5ceff9b60.tar.gz
cpython-305480c9dcec736cba91db62062f75b5ceff9b60.tar.bz2
Issue 3116: fix quadratic behavior in marshal.dumps().
Diffstat (limited to 'Python')
-rw-r--r--Python/marshal.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index 6db46e4..140192f 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -67,7 +67,7 @@ w_more(int c, WFILE *p)
size = PyString_Size(p->str);
newsize = size + size + 1024;
if (newsize > 32*1024*1024) {
- newsize = size + 1024*1024;
+ newsize = size + (size >> 3); /* 12.5% overallocation */
}
if (_PyString_Resize(&p->str, newsize) != 0) {
p->ptr = p->end = NULL;