mirror of
https://github.com/python/cpython.git
synced 2025-07-27 21:24:32 +00:00
Issue 3116: fix quadratic behavior in marshal.dumps().
This commit is contained in:
parent
a161f6070b
commit
305480c9dc
2 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue