Hi Guido,
Agree with both your points.
Attaching a patch that fixes this issue.
1. Raises TypeError exception when header is not a Mapping or email.message.Message type.
2. Asserts for fp.read and fp.readline() to assert that fp, the first argument to FieldStorage is a file like object. I would have preferred to assert fp as a type of BytesIO object, but I saw some tests failings, so that could be taken as a separate 3.4 only backwards incompatible improvement (and not bug fix).
Finally, in the cases where read_single() is called for FieldStorage(), bool() raises valid TypeError for empty FieldStorage.
Please review and if it is OK, I can check this in. |