Mercurial > cpython-lru_cache-weakref
comparison Python/errors.c @ 6358:9e82dd76288e legacy-trunk
PyErr_NormalizeException(): If the exception's type is a class and the
instance's class is a subclass of this, then use the instance's class
as the exception type.
| author | Barry Warsaw <barry@python.org> |
|---|---|
| date | Tue, 30 Sep 1997 15:00:18 +0000 |
| parents | b7f0b98f5325 |
| children | 4cb223f29337 |
comparison
equal
deleted
inserted
replaced
| 6357:174c1bcc8e2d | 6358:9e82dd76288e |
|---|---|
| 204 if (res == NULL) | 204 if (res == NULL) |
| 205 goto finally; | 205 goto finally; |
| 206 Py_DECREF(value); | 206 Py_DECREF(value); |
| 207 value = res; | 207 value = res; |
| 208 } | 208 } |
| 209 /* if the class of the instance doesn't exactly match the | |
| 210 class of the type, believe the instance | |
| 211 */ | |
| 212 else if (inclass != type) { | |
| 213 Py_DECREF(type); | |
| 214 type = inclass; | |
| 215 Py_INCREF(type); | |
| 216 } | |
| 209 } | 217 } |
| 210 *exc = type; | 218 *exc = type; |
| 211 *val = value; | 219 *val = value; |
| 212 return; | 220 return; |
| 213 finally: | 221 finally: |
