Andrew Swan added the comment:
I just got tripped up by this change, I wanted to catch the specific case of an
http server closing a connection and assumed that the following would work:
try:
resp = conn.getresponse()
except httplib.BadStatusLine, e:
if len(e.line) == 0:
# server closed...
else:
raise
That doesn't work since e.line holds the representation of the empty string
instead of just holding the empty string. I think the fragment above would be
a much better way to write this test, the current alterntative of:
if e.line == "''":
is hopelessly obscure.
Seems like the original fix should have been to add __repr__ to BadStatusLine
rather than changing its contents. Can this be revisited?
----------
nosy: +aswan
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue7427>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com