[issue15267] tempfile.TemporaryFile and httplib incompatibility

2015-05-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Catching TypeError or AttributeError on len() is a hack, but it is compatible with Python 3 and older code. We could handle this in issue23740. Changing TemporaryFile would solve this issue, but only for TemporaryFile. len() raises AttributeError for other f

[issue15267] tempfile.TemporaryFile and httplib incompatibility

2015-05-16 Thread Roundup Robot
Roundup Robot added the comment: New changeset c34513c2a894 by Serhiy Storchaka in branch '2.7': Issue #15267: HTTPConnection.request() now is compatibile with old-style https://hg.python.org/cpython/rev/c34513c2a894 -- nosy: +python-dev ___ Python tr

[issue15267] tempfile.TemporaryFile and httplib incompatibility

2015-05-16 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue15267] tempfile.TemporaryFile and httplib incompatibility

2015-04-11 Thread R. David Murray
R. David Murray added the comment: We don't do classic to new style class changes for bug fixes without a compelling reason; we've been bitten by unexpected breakage doing that in the past. -- nosy: +r.david.murray ___ Python tracker

[issue15267] tempfile.TemporaryFile and httplib incompatibility

2015-04-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: More general and simple solution is to make tempfile.NamedTemporaryFile new-style class. Old-style class: >>> import tempfile >>> f = tempfile.NamedTemporaryFile() >>> len(f) Traceback (most recent call last): File "", line 1, in File "/home/serhiy/py/c

[issue15267] tempfile.TemporaryFile and httplib incompatibility

2015-04-11 Thread Martin Panter
Martin Panter added the comment: See also Issue 23740, about cleaning up the types for computing Content-Length in 3.5. -- nosy: +vadmium ___ Python tracker ___

[issue15267] tempfile.TemporaryFile and httplib incompatibility

2014-12-12 Thread STINNER Victor
STINNER Victor added the comment: issue15267.patch: I would feel more confortable if test_send_tempfile() ensures that the socket contains the file content. -- ___ Python tracker __

[issue15267] tempfile.TemporaryFile and httplib incompatibility

2014-12-12 Thread STINNER Victor
STINNER Victor added the comment: Catching TypeError on len() looks as an ugly test to check if body is a string. Why not doing the opposite: first to call fileno() and call AttributeError? Or even use hasattr(body, "fileno")? -- nosy: +haypo ___ Py

[issue15267] tempfile.TemporaryFile and httplib incompatibility

2014-12-11 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- keywords: +needs review stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue15267] tempfile.TemporaryFile and httplib incompatibility

2014-07-23 Thread Demian Brecht
Changes by Demian Brecht : -- nosy: +demian.brecht ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue15267] tempfile.TemporaryFile and httplib incompatibility

2013-05-15 Thread Геннадий Егоров
Геннадий Егоров added the comment: i think it is not good, len(fd) must raise AttributeError, not TypeError -- nosy: +Геннадий.Егоров ___ Python tracker ___ _

[issue15267] tempfile.TemporaryFile and httplib incompatibility

2012-07-30 Thread Atsuo Ishimoto
Atsuo Ishimoto added the comment: patch contains fix and test for 2.7. With this patch, AttibuteError is captured as Tim sujested. -- keywords: +patch nosy: +ishimoto Added file: http://bugs.python.org/file26595/issue15267.patch ___ Python tracker

[issue15267] tempfile.TemporaryFile and httplib incompatibility

2012-07-10 Thread Tim Golden
Tim Golden added the comment: I can confirm that this isn't a problem for 3.x. No-one's listed in the experts list for the httplib module but Senthil appears to be the de factor maintainer so I've added him to the call for his opinion. My feeling would be to do the simplest thing possible and

[issue15267] tempfile.TemporaryFile and httplib incompatibility

2012-07-09 Thread Tim Smith
Tim Smith added the comment: Here is a program that demonstrates the problem: import httplib import tempfile f = tempfile.TemporaryFile() f.write("Hello, Temporary File!") f.seek(0) c = httplib.HTTPConnection('bugs.python.org') c.request('POST', '/', f, {'Content-t

[issue15267] tempfile.TemporaryFile and httplib incompatibility

2012-07-09 Thread Ramchandra Apte
Ramchandra Apte added the comment: BTW, type(0) should be replaced with int in the code. -- nosy: +ramchandra.apte ___ Python tracker ___ ___

[issue15267] tempfile.TemporaryFile and httplib incompatibility

2012-07-09 Thread Tim Golden
Tim Golden added the comment: Could you create a failing test, please, Tim S? -- nosy: +tim.golden ___ Python tracker ___ ___ Python-

[issue15267] tempfile.TemporaryFile and httplib incompatibility

2012-07-06 Thread Tim Smith
New submission from Tim Smith : In httplib.py, there is this code to try to get the body length: def _set_content_length(self, body): # Set the content-length based on the body. thelen = None try: thelen = str(len(body)) except TypeError, te: