mirror of
https://github.com/python/cpython.git
synced 2024-11-28 12:31:14 +08:00
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.
This commit is contained in:
parent
4ebf3be407
commit
7fed217515
@ -19,7 +19,7 @@ written in Python.
|
|||||||
# responsible for its maintenance.
|
# responsible for its maintenance.
|
||||||
#
|
#
|
||||||
|
|
||||||
__version__ = "2.4"
|
__version__ = "2.5"
|
||||||
|
|
||||||
|
|
||||||
# Imports
|
# Imports
|
||||||
@ -497,7 +497,6 @@ class FieldStorage:
|
|||||||
|
|
||||||
self.list = self.file = None
|
self.list = self.file = None
|
||||||
self.done = 0
|
self.done = 0
|
||||||
self.lines = []
|
|
||||||
if ctype == 'application/x-www-form-urlencoded':
|
if ctype == 'application/x-www-form-urlencoded':
|
||||||
self.read_urlencoded()
|
self.read_urlencoded()
|
||||||
elif ctype[:10] == 'multipart/':
|
elif ctype[:10] == 'multipart/':
|
||||||
@ -633,7 +632,6 @@ class FieldStorage:
|
|||||||
if not line:
|
if not line:
|
||||||
self.done = -1
|
self.done = -1
|
||||||
break
|
break
|
||||||
self.lines.append(line)
|
|
||||||
self.file.write(line)
|
self.file.write(line)
|
||||||
|
|
||||||
def read_lines_to_outerboundary(self):
|
def read_lines_to_outerboundary(self):
|
||||||
@ -646,7 +644,6 @@ class FieldStorage:
|
|||||||
if not line:
|
if not line:
|
||||||
self.done = -1
|
self.done = -1
|
||||||
break
|
break
|
||||||
self.lines.append(line)
|
|
||||||
if line[:2] == "--":
|
if line[:2] == "--":
|
||||||
strippedline = string.strip(line)
|
strippedline = string.strip(line)
|
||||||
if strippedline == next:
|
if strippedline == next:
|
||||||
@ -676,7 +673,6 @@ class FieldStorage:
|
|||||||
if not line:
|
if not line:
|
||||||
self.done = -1
|
self.done = -1
|
||||||
break
|
break
|
||||||
self.lines.append(line)
|
|
||||||
if line[:2] == "--":
|
if line[:2] == "--":
|
||||||
strippedline = string.strip(line)
|
strippedline = string.strip(line)
|
||||||
if strippedline == next:
|
if strippedline == next:
|
||||||
|
Loading…
Reference in New Issue
Block a user