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 <1348616912.61.0.974759857919.issue7427@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2012-09-25 23:48:32aswansetrecipients: + aswan, djc, eric.araujo, jakemcguire
2012-09-25 23:48:32aswansetmessageid: <1348616912.61.0.974759857919.issue7427@psf.upfronthosting.co.za>
2012-09-25 23:48:11aswanlinkissue7427 messages
2012-09-25 23:48:11aswancreate