[Python-checkins] CVS: python/dist/src/Lib warnings.py,1.8,1.9

Guido van Rossum gvanrossum@users.sourceforge.net
Fri, 31 Aug 2001 10:46:37 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv12729

Modified Files:
	warnings.py 
Log Message:
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.


Index: warnings.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/warnings.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** warnings.py	2001/08/23 03:07:42	1.8
--- warnings.py	2001/08/31 17:46:35	1.9
***************
*** 25,29 ****
          globals = caller.f_globals
          lineno = caller.f_lineno
!     module = globals['__name__']
      filename = globals.get('__file__')
      if filename:
--- 25,32 ----
          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: