[issue19097] bool(cgi.FieldStorage(...)) may be False unexpectedly
Guido van Rossum
report at bugs.python.org
Fri Sep 27 01:54:42 CEST 2013
New submission from Guido van Rossum:
Check out http://stackoverflow.com/questions/9327597/python-get-does-not-evaluate-to-true-even-though-there-is-an-object
It turns out a cgi.FieldStorage object may consider itself False even when it has data. This happens when the initialization decided to use read_single() instead of one of the other ways of reading the field value (read_urlencoded() or read_multi()). Then self.list remains None, and __nonzero__ returns False no matter what the contents of self.file is.
To make things worse -- or better? -- the Python 3 version still defines __nonzero__() instead of __bool__().
----------
messages: 198457
nosy: gvanrossum
priority: normal
severity: normal
status: open
title: bool(cgi.FieldStorage(...)) may be False unexpectedly
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19097>
_______________________________________
More information about the Python-bugs-list
mailing list