homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Marcel.Hellkamp
Recipients Marcel.Hellkamp, barry, brett.cannon, flox, madison.may, orsenthil, pitrou, python-dev, serhiy.storchaka, vajrasky
Date 2014年01月12日.14:32:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1389537166.72.0.555639373457.issue18394@psf.upfronthosting.co.za>
In-reply-to
Content
This change breaks existing applications.
The cgi.FieldStorage.file attribute is public and mentioned in the documentation. It even states "You can then read the data at leisure from the file attribute".
Consider this example::
 form = cgi.FieldStorage()
 fileitem = form.getfirst("userfile")
 if fileitem and fileitem.file:
 executor.submit(store_file, fileitem.file, fileitem.filename)
This code is no longer safe. The garbage collector might close the file handle while it is still referenced and accessed from the worker thread.
Another example is the bottle web framework. It uses cgi.FieldStorage for parsing only, extracts the valuable information and stores the result in its own data structures. The cgi.FieldStorage instance is lost. Python 3.4 breaks every single bottle application that works with file uploads.
How about implementing the context manager protocol for cgi.FieldStorage to resolve this issue?
History
Date User Action Args
2014年01月12日 14:32:46Marcel.Hellkampsetrecipients: + Marcel.Hellkamp, barry, brett.cannon, orsenthil, pitrou, flox, python-dev, serhiy.storchaka, madison.may, vajrasky
2014年01月12日 14:32:46Marcel.Hellkampsetmessageid: <1389537166.72.0.555639373457.issue18394@psf.upfronthosting.co.za>
2014年01月12日 14:32:46Marcel.Hellkamplinkissue18394 messages
2014年01月12日 14:32:46Marcel.Hellkampcreate

AltStyle によって変換されたページ (->オリジナル) /