summaryrefslogtreecommitdiffstats
path: root/Lib/warnings.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-03-11 04:51:06 (GMT)
committerBrett Cannon <bcannon@gmail.com>2009-03-11 04:51:06 (GMT)
commit6c4cff0f32c574454114d4cff6bd5f6d2870c04d (patch)
treefdbdf406cf2042452c43b6a9901a641da79b0c1f /Lib/warnings.py
parent8f19598f78fe767b0ae91d6265eb193cb08820eb (diff)
downloadcpython-6c4cff0f32c574454114d4cff6bd5f6d2870c04d.zip
cpython-6c4cff0f32c574454114d4cff6bd5f6d2870c04d.tar.gz
cpython-6c4cff0f32c574454114d4cff6bd5f6d2870c04d.tar.bz2
Require implementations for warnings.showwarning() support the 'line' argument.
Was a DeprecationWarning for not supporting it since Python 2.6. Closes issue #3652.
Diffstat (limited to 'Lib/warnings.py')
-rw-r--r--Lib/warnings.py18
1 files changed, 0 insertions, 18 deletions
diff --git a/Lib/warnings.py b/Lib/warnings.py
index 59011ca..14466d3 100644
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -262,24 +262,6 @@ def warn_explicit(message, category, filename, lineno,
raise RuntimeError(
"Unrecognized action (%r) in warnings.filters:\n %s" %
(action, item))
- # Warn if showwarning() does not support the 'line' argument.
- # Don't use 'inspect' as it relies on an extension module, which break the
- # build thanks to 'warnings' being imported by setup.py.
- fxn_code = None
- if hasattr(showwarning, 'func_code'):
- fxn_code = showwarning.func_code
- elif hasattr(showwarning, '__func__'):
- fxn_code = showwarning.__func__.func_code
- if fxn_code:
- args = fxn_code.co_varnames[:fxn_code.co_argcount]
- CO_VARARGS = 0x4
- if 'line' not in args and not fxn_code.co_flags & CO_VARARGS:
- showwarning_msg = ("functions overriding warnings.showwarning() "
- "must support the 'line' argument")
- if message == showwarning_msg:
- _show_warning(message, category, filename, lineno)
- else:
- warn(showwarning_msg, DeprecationWarning)
# Print message and context
showwarning(message, category, filename, lineno)