From: Georg Brandl Date: Fri, 13 Jan 2006 16:59:46 +0000 (+0000) Subject: Bug #1403410: The warnings module now doesn't get confused X-Git-Tag: v2.5a0~831 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4edd989eaf5bae40f9e11424b36b22892c5ba459;p=python Bug #1403410: The warnings module now doesn't get confused when it can't find out the module name it generates a warning for. --- diff --git a/Lib/warnings.py b/Lib/warnings.py index 5eac60f7c5..8baac479cd 100644 --- a/Lib/warnings.py +++ b/Lib/warnings.py @@ -63,7 +63,7 @@ def warn(message, category=None, stacklevel=1): def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: - module = filename + module = filename or "" if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: diff --git a/Misc/NEWS b/Misc/NEWS index 6729ea8a79..a95774fcec 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -335,6 +335,9 @@ Extension Modules Library ------- +- Bug #1403410: The warnings module now doesn't get confused + when it can't find out the module name it generates a warning for. + - Patch #1177307: Added a new codec utf_8_sig for UTF-8 with a BOM signature. - Patch #1157027: cookielib mishandles RFC 2109 cookies in Netscape mode