Author aswan
Recipients aswan, djc, eric.araujo, jakemcguire
Date 2012-09-25.23:48:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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:

  resp = conn.getresponse()
except httplib.BadStatusLine, e:
  if len(e.line) == 0:
    # server closed...

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?
Date User Action Args
2012-09-25 23:48:32aswansetrecipients: + aswan, djc, eric.araujo, jakemcguire
2012-09-25 23:48:32aswansetmessageid: <>
2012-09-25 23:48:11aswanlinkissue7427 messages
2012-09-25 23:48:11aswancreate