| Joel Uckelman on Wed, 22 Dec 2004 22:10:30 -0600 (CST) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| [nimh-dev] bugs in mhlib |
Rather than drink myself into a stupor after botching my abstract algebra
final, I decided to do something constructive and hack on nimh tonight.
I've been trying to finish Folder.parsesequence() and I've run into
something which I think is a bug in mhlib. If you scan for a sequence which
doesn't exist, an Error is thrown, but there's no error message
accompanying it.
Here's the relevant bit of code from Folder.parsesequence():
try:
n = self._parseindex(seq, all)
except Error, msg:
seqs = self.getsequences()
if not seq in seqs:
if not msg:
msg = "bad message list %s" % seq
raise Error, msg
return seqs[seq]
If you do a 'scan.py foo', self._parseindex() will do this:
raise Error, None
Following along in the code above, it catches the Error and checks whether
foo is a user-defined sequence. Now, here's where things go bad. I think
what was intended is that if foo isn't a sequence, then we'll have no error
message, so one needs to be set. The problem is that msg is the Error
object, not the error string, and the error object never evaluates to
false, so the proper message never gets set.
Do either of you know whether the semantics for exception objects has
changed recently, like maybe they evaluated to their string contents or
something? Otherwise, I don't see how this could ever have worked
properly...
--
J.
_______________________________________________
nimh-dev mailing list
nimh-dev@xxxxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/nimh-dev