Message253519
There is already a check for request.data being str in do_request_(). Maybe it is okay to remove this check; I think it would be equivalent to the new check.
Regarding the dict check, here is a strange class that currently works, but would be broken by the patch. Maybe it is okay to break it though, since it certainly goes against the urlopen() documentation.
class ReaderMapping(dict):
def __init__(self):
super().__init__({"abc": "xyz"})
self.mode = "r"
self.data = "123"
def read(self, size):
data = self.data
self.data = ""
return data
urlopen(Request("http://localhost/", headers={"Content-Length": 3}, data=ReaderMapping()))
If we wanted to continue to support this kind of usage, perhaps the safest option would be to change the test to “if type(data) is dict” rather than use isinstance().
I also left a comment about eliminating urlencode() in the test. |
|
Date |
User |
Action |
Args |
2015-10-27 05:18:42 | martin.panter | set | recipients:
+ martin.panter, ezio.melotti, Nan Wu |
2015-10-27 05:18:42 | martin.panter | set | messageid: <1445923122.1.0.532852696458.issue25439@psf.upfronthosting.co.za> |
2015-10-27 05:18:42 | martin.panter | link | issue25439 messages |
2015-10-27 05:18:40 | martin.panter | create | |
|