[Python-Dev] Deprecating string exceptions

Jeremy Hylton jeremy@zope.com
Fri, 5 Apr 2002 20:03:53 -0500


>>>>> "GvR" == Guido van Rossum <guido@python.org> writes:

  >> I didn't read most of this length thread the first time through,
  >> but I did run into the bug today in my own code and tried to fix
  >> it.  I added a patch to 518846 that allows instances of new style
  >> classes, where the check is implemented by checking
  >> Py_TPFLAGS_HEAPTYPE, which is only defined for objects created by
  >> class statements (I think).
  >>
  >> This doesn't seem to cause any change in the behavior of
  >> string-based exceptions.  I don't think it's necessary to have
  >> "except str:" catch string-based exceptions, because they're
  >> supported solely for backwards compatibility.
  >>
  >> There was also some discussion of making exceptions inherit from
  >> Exception, but I think that's a separate issue.
  >>
  >> Any reason not to commit the patch?

  GvR> In how many places have you posted about this issue?  This is
  GvR> the third place where I see you trying to get people's
  GvR> attention.  What's the urgency? :-)

There's no urgency at all but a bug report isn't the right place for
the discussin, nor is our group's private email.   I didn't think that
raising the question in the appropriate forum constituted emergency
action :-).

  GvR> I don't think the patch is ready yet, see my comment on SF.  If
  GvR> we decide that anything needs to be done in this area I want to
  GvR> look at it first, so please don't check anything in yet.

Did I miss the consensus on inheriting from Exception?  I tried to
review the earlier thread, but the early stuff didn't have much on
Exception and the later stuff seemed to be about documentation.  So it
must be buried in the middle if it's there :-).

At any rate, I don't understand why it is helpful for classes to
inherit from exception.

I am also curious -- this is off-topic for exceptions -- what the
right way to check for a new-style class is?  And what other things
define Py_TPFLAGS_HEAPTYPE?

Jeremy