From f2f9c403576120170f7e865ef7fb8b109293a050 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 13 Jan 2006 16:59:54 +0000 Subject: [PATCH] Bug #1403410: The warnings module now doesn't get confused when it can't find out the module name it generates a warning for. --- Lib/warnings.py | 2 +- Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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. -- 2.47.3