Commit 8031bbec authored by Guido van Rossum's avatar Guido van Rossum

Allow for the possibility that globals['__name__'] does not exist;

substitute "<string>" for the module name in that case.  This actually
occurred when running test_descr.py with -Dwarn.
parent 393661d1
......@@ -24,7 +24,10 @@ def warn(message, category=None, stacklevel=1):
else:
globals = caller.f_globals
lineno = caller.f_lineno
if globals.has_key('__name__'):
module = globals['__name__']
else:
module = "<string>"
filename = globals.get('__file__')
if filename:
fnl = filename.lower()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment