diff options
author | Brett Cannon <bcannon@gmail.com> | 2006-03-01 04:25:17 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2006-03-01 04:25:17 (GMT) |
commit | bf36409e2a8171b441d5e0a2f1c9e02d31a35ae8 (patch) | |
tree | 7456cf3d197d6f0dc017b0f851878bcaf6024f6c /Lib/warnings.py | |
parent | 762467475d944f67ac20bf23c6c5144a6e39feae (diff) | |
download | cpython-bf36409e2a8171b441d5e0a2f1c9e02d31a35ae8.zip cpython-bf36409e2a8171b441d5e0a2f1c9e02d31a35ae8.tar.gz cpython-bf36409e2a8171b441d5e0a2f1c9e02d31a35ae8.tar.bz2 |
PEP 352 implementation. Creates a new base class, BaseException, which has an
added message attribute compared to the previous version of Exception. It is
also a new-style class, making all exceptions now new-style. KeyboardInterrupt
and SystemExit inherit from BaseException directly. String exceptions now
raise DeprecationWarning.
Applies patch 1104669, and closes bugs 1012952 and 518846.
Diffstat (limited to 'Lib/warnings.py')
-rw-r--r-- | Lib/warnings.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/warnings.py b/Lib/warnings.py index 8baac47..e622b9a 100644 --- a/Lib/warnings.py +++ b/Lib/warnings.py @@ -145,7 +145,8 @@ def filterwarnings(action, message="", category=Warning, module="", lineno=0, assert action in ("error", "ignore", "always", "default", "module", "once"), "invalid action: %r" % (action,) assert isinstance(message, basestring), "message must be a string" - assert isinstance(category, types.ClassType), "category must be a class" + assert isinstance(category, (type, types.ClassType)), \ + "category must be a class" assert issubclass(category, Warning), "category must be a Warning subclass" assert isinstance(module, basestring), "module must be a string" assert isinstance(lineno, int) and lineno >= 0, \ |