summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-01-13 16:59:46 (GMT)
committerGeorg Brandl <georg@python.org>2006-01-13 16:59:46 (GMT)
commit4edd989eaf5bae40f9e11424b36b22892c5ba459 (patch)
tree02285d5f9d5e48ad342b4a695d1e8691ee5998b3 /Lib
parenta28ad77844d7db11ed4c3b89c61b83cc4c02848a (diff)
downloadcpython-4edd989eaf5bae40f9e11424b36b22892c5ba459.zip
cpython-4edd989eaf5bae40f9e11424b36b22892c5ba459.tar.gz
cpython-4edd989eaf5bae40f9e11424b36b22892c5ba459.tar.bz2
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')
-rw-r--r--Lib/warnings.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/warnings.py b/Lib/warnings.py
index 5eac60f..8baac47 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: