summaryrefslogtreecommitdiff
path: root/Lib/warnings.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-01-13 16:59:46 +0000
committerGeorg Brandl <georg@python.org>2006-01-13 16:59:46 +0000
commit9a5795f9d19bf36aec77d1454a284a3f64c2802f (patch)
tree2727c93949d1a05b939e96d9cb0851ea86593971 /Lib/warnings.py
parent9974cde8a4da2d6ba06f27b727467b327d493d8e (diff)
downloadcpython-9a5795f9d19bf36aec77d1454a284a3f64c2802f.tar.gz
Bug #1403410: The warnings module now doesn't get confused
when it can't find out the module name it generates a warning for.
Diffstat (limited to 'Lib/warnings.py')
-rw-r--r--Lib/warnings.py2
1 files changed, 1 insertions, 1 deletions
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 "<unknown>"
if module[-3:].lower() == ".py":
module = module[:-3] # XXX What about leading pathname?
if registry is None: