Issue 6790: httplib and array do not play together well (original) (raw)

Issue6790

Created on 2009-08-27 21:08 by jakemcguire, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue6790-python2.7.diff KirkMcDonald,2009-09-25 22:00 Remove array.array.read and .write in 2.7.
issue6790-python2.6.diff KirkMcDonald,2009-09-29 00:24 special-case array.array, and add unittest for httplib.HTTPConnection.send
Messages (11)
msg92015 - (view) Author: Jake McGuire (jakemcguire) Date: 2009-08-27 21:08
As of Python 2.6 you can no longer pass an array to httplib.HTTPConnection.send. Issue1065257 added code to httplib to attempt to determine whether a file-like object was passed to certain methods (e.g. send), and to stream the data if so. The patch uses "hasattr(obj, 'read')" as a proxy for "is a file-like object". array.array objects have a method called "read" that is almost entirely disanalogous to the "read" method on a file-like object. Hilarity ensues.
msg92017 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-08-27 21:34
That method of array.array has been deprecated since 1.5.1 according to the docs. Too bad nobody finished the job and removed it. Perhaps array.array could be special cased in the relevant code until the method can actually be removed.
msg93145 - (view) Author: Kirk McDonald (KirkMcDonald) Date: 2009-09-25 21:59
Here is a patch special-casing array.array in httplib.HTTPConnection.send in Python 2.6.
msg93146 - (view) Author: Kirk McDonald (KirkMcDonald) Date: 2009-09-25 22:00
And here is a patch removing the array.array.read and .write methods in 2.7.
msg93221 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-09-28 18:07
These methods don't even produce a DeprecationWarning in current 2.6, I don't think it's ok to remove them. As for the special casing patch, it would be better with a test.
msg93245 - (view) Author: Kirk McDonald (KirkMcDonald) Date: 2009-09-28 23:19
I have updated the patch with a unittest for httplib.HTTPConnection.send.
msg93247 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-09-28 23:54
Why do you need to give a non-empty body to the FakeSocket? Other than that, looks fine.
msg93248 - (view) Author: Kirk McDonald (KirkMcDonald) Date: 2009-09-28 23:59
Oh, I suppose I don't. I had simply copy and pasted those four lines from the previous method. That line could easily be removed.
msg93249 - (view) Author: Kirk McDonald (KirkMcDonald) Date: 2009-09-29 00:24
Remove unused 'body'.
msg93270 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-09-29 10:07
-python2.6.diff is ok, can you commit to trunk and then merge?
msg93315 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-09-29 19:03
Committed in r75134, r75135, r75137, r75142. Thanks!
History
Date User Action Args
2022-04-11 14:56:52 admin set github: 51039
2009-09-29 19:03:22 pitrou set status: open -> closedresolution: accepted -> fixedmessages: +
2009-09-29 17:33:31 pitrou set assignee: pitrou
2009-09-29 10:07:09 pitrou set resolution: acceptedmessages: +
2009-09-29 00:25:16 KirkMcDonald set files: - issue6790-python2.6.diff
2009-09-29 00:24:39 KirkMcDonald set files: + issue6790-python2.6.diffmessages: +
2009-09-28 23:59:19 KirkMcDonald set messages: +
2009-09-28 23:54:22 pitrou set messages: +
2009-09-28 23:19:41 KirkMcDonald set files: - issue6790-python2.6.diff
2009-09-28 23:19:30 KirkMcDonald set files: + issue6790-python2.6.diffmessages: +
2009-09-28 18:07:25 pitrou set nosy: + pitroumessages: +
2009-09-25 22:00:29 KirkMcDonald set files: + issue6790-python2.7.diffmessages: +
2009-09-25 21:59:30 KirkMcDonald set files: + issue6790-python2.6.diffnosy: + KirkMcDonaldmessages: + keywords: + patch
2009-08-27 21:34:17 r.david.murray set priority: normalversions: + Python 3.1, Python 2.7, Python 3.2keywords: + easynosy: + r.david.murraymessages: + stage: test needed
2009-08-27 21:08:18 jakemcguire create