Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7fed217

Browse files
committed
This fixes several bug reports concering memory bloating during large
file uploads. In response to SF bugs 110674 and 119806, and discussions on python-dev, we are removing the self.lines attribute from the FieldStorage class. Specifically touched where methods __init__(), read_lines_to_eof(), and skip_lines(). No one can remember why self.lines was added. Technically, it's part of the public interface for the class, but it was never documented. It's possible clever or nosy code will break because of this, but it was decided to remove it and see who complains. This resolution also closes the second half of the cgi.py entry in PEP 42. The first half of that PEP concerns specifically binary file uploads, where there may be no end-of-line marker for a very long time. This patch does not address that issue.
1 parent 4ebf3be commit 7fed217

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

Lib/cgi.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# responsible for its maintenance.
2020
#
2121

22-
__version__ = "2.4"
22+
__version__ = "2.5"
2323

2424

2525
# Imports
@@ -497,7 +497,6 @@ def __init__(self, fp=None, headers=None, outerboundary="",
497497

498498
self.list = self.file = None
499499
self.done = 0
500-
self.lines = []
501500
if ctype == 'application/x-www-form-urlencoded':
502501
self.read_urlencoded()
503502
elif ctype[:10] == 'multipart/':
@@ -633,7 +632,6 @@ def read_lines_to_eof(self):
633632
if not line:
634633
self.done = -1
635634
break
636-
self.lines.append(line)
637635
self.file.write(line)
638636

639637
def read_lines_to_outerboundary(self):
@@ -646,7 +644,6 @@ def read_lines_to_outerboundary(self):
646644
if not line:
647645
self.done = -1
648646
break
649-
self.lines.append(line)
650647
if line[:2] == "--":
651648
strippedline = string.strip(line)
652649
if strippedline == next:
@@ -676,7 +673,6 @@ def skip_lines(self):
676673
if not line:
677674
self.done = -1
678675
break
679-
self.lines.append(line)
680676
if line[:2] == "--":
681677
strippedline = string.strip(line)
682678
if strippedline == next:

0 commit comments

Comments
 (0)