]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
Moved the raise logic out of the main interpreter loop to a separate function.
authorGuido van Rossum <guido@python.org>
Tue, 10 Dec 1996 18:07:35 +0000 (18:07 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 10 Dec 1996 18:07:35 +0000 (18:07 +0000)
commit0aa9ee65ab66627c2d065d213090aec93e634ee9
treeee0ec8ac491f39baddc05994df998553714bcd2e
parent6c31a14de7b9a447fa476b773ae895b219f212e6
Moved the raise logic out of the main interpreter loop to a separate function.

The raise logic has one additional feature: if you raise <class>,
<value> where <value> is not an instance, it will construct an
instance using <value> as argument.  If <value> is None, <class> is
instantiated without arguments.  If <value> is a tuple, it is used as
the argument list.

This feature is intended to make it easier to upgrade code from using
string exceptions to using class exceptions; without this feature,
you'd have to change every raise statement from ``raise X'' to ``raise
X()'' and from ``raise X, y'' to ``raise X(y)''.  The latter is still
the recommended form (because it has no ambiguities about the number
of arguments), but this change makes the transition less painful.
Python/ceval.c