]> granicus.if.org Git - python/commit
Three new C API functions:
authorBarry Warsaw <barry@python.org>
Fri, 22 Aug 1997 21:22:58 +0000 (21:22 +0000)
committerBarry Warsaw <barry@python.org>
Fri, 22 Aug 1997 21:22:58 +0000 (21:22 +0000)
commitc0dc92af7d41ecf1d60f4ab29452d7179c039d8c
tree207d717b9b91dac3b1b7a605ed2292cc87830e69
parentcde8b1ba0c0948f2cec00d11821214e06ca419cb
Three new C API functions:

- int PyErr_GivenExceptionMatches(obj1, obj2)

  Returns 1 if obj1 and obj2 are the same object, or if obj1 is an
  instance of type obj2, or of a class derived from obj2

- int PyErr_ExceptionMatches(obj)

  Higher level wrapper around PyErr_GivenExceptionMatches() which uses
  PyErr_Occurred() as obj1.  This will be the more commonly called
  function.

- void PyErr_NormalizeException(typeptr, valptr, tbptr)

  Normalizes exceptions, and places the normalized values in the
  arguments.  If type is not a class, this does nothing.  If type is a
  class, then it makes sure that value is an instance of the class by:

  1. if instance is of the type, or a class derived from type, it does
     nothing.

  2. otherwise it instantiates the class, using the value as an
     argument.  If value is None, it uses an empty arg tuple, and if
     the value is a tuple, it uses just that.
Include/pyerrors.h
Python/errors.c