From: Georg Brandl Date: Fri, 13 Jan 2006 16:59:54 +0000 (+0000) Subject: Bug #1403410: The warnings module now doesn't get confused X-Git-Tag: v2.4.3c1~142 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2f9c403576120170f7e865ef7fb8b109293a050;p=thirdparty%2FPython%2Fcpython.git 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 8d8c36d89010..fc49ca0b5dbe 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 30591b51fa7e..ca9317163a21 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -68,6 +68,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 #1117398: cookielib.LWPCookieJar and .MozillaCookieJar now raise LoadError as documented, instead of IOError. For compatibility, LoadError subclasses IOError.