diff options
Diffstat (limited to 'Lib/warnings.py')
-rw-r--r-- | Lib/warnings.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/warnings.py b/Lib/warnings.py index 5badb0b..d7d88d3 100644 --- a/Lib/warnings.py +++ b/Lib/warnings.py @@ -209,7 +209,7 @@ def _setoption(arg): if lineno < 0: raise ValueError except (ValueError, OverflowError): - raise _OptionError("invalid lineno %r" % (lineno,)) + raise _OptionError("invalid lineno %r" % (lineno,)) from None else: lineno = 0 filterwarnings(action, message, category, module, lineno) @@ -233,7 +233,7 @@ def _getcategory(category): try: cat = eval(category) except NameError: - raise _OptionError("unknown warning category: %r" % (category,)) + raise _OptionError("unknown warning category: %r" % (category,)) from None else: i = category.rfind(".") module = category[:i] @@ -241,11 +241,11 @@ def _getcategory(category): try: m = __import__(module, None, None, [klass]) except ImportError: - raise _OptionError("invalid module name: %r" % (module,)) + raise _OptionError("invalid module name: %r" % (module,)) from None try: cat = getattr(m, klass) except AttributeError: - raise _OptionError("unknown warning category: %r" % (category,)) + raise _OptionError("unknown warning category: %r" % (category,)) from None if not issubclass(cat, Warning): raise _OptionError("invalid warning category: %r" % (category,)) return cat |