diff options
Diffstat (limited to 'Lib/warnings.py')
-rw-r--r-- | Lib/warnings.py | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/Lib/warnings.py b/Lib/warnings.py index 31d4ad1..9763dc6 100644 --- a/Lib/warnings.py +++ b/Lib/warnings.py @@ -131,29 +131,29 @@ def _processoptions(args): # Helper for _processoptions() def _setoption(arg): - parts = arg.split(':') - if len(parts) > 5: - raise _OptionError("too many fields (max 5): %s" % `arg`) - while len(parts) < 5: - parts.append('') - action, message, category, module, lineno = [s.strip() - for s in parts] - action = _getaction(action) - message = re.escape(message) - category = _getcategory(category) - module = re.escape(module) - if module: - module = module + '$' - if lineno: - try: - lineno = int(lineno) - if lineno < 0: - raise ValueError - except (ValueError, OverflowError): - raise _OptionError("invalid lineno %s" % `lineno`) - else: - lineno = 0 - filterwarnings(action, message, category, module, lineno) + parts = arg.split(':') + if len(parts) > 5: + raise _OptionError("too many fields (max 5): %s" % `arg`) + while len(parts) < 5: + parts.append('') + action, message, category, module, lineno = [s.strip() + for s in parts] + action = _getaction(action) + message = re.escape(message) + category = _getcategory(category) + module = re.escape(module) + if module: + module = module + '$' + if lineno: + try: + lineno = int(lineno) + if lineno < 0: + raise ValueError + except (ValueError, OverflowError): + raise _OptionError("invalid lineno %s" % `lineno`) + else: + lineno = 0 + filterwarnings(action, message, category, module, lineno) # Helper for _setoption() def _getaction(action): |