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

Jeremy Hylton jhylton@users.sourceforge.net
2001年11月09日 11:49:53 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv24749
Modified Files:
	test_compile.py 
Log Message:
Fix SF buf #480096: Assign to __debug__ still allowed
Easy enough to catch assignment in the compiler. The perverse user
can still change the value of __debug__, but that may be the least he
can do.
Index: test_compile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_compile.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** test_compile.py	2001年08月30日 20:51:59	1.8
--- test_compile.py	2001年11月09日 19:49:49	1.9
***************
*** 2,5 ****
--- 2,16 ----
 
 if verbose:
+ print "Testing whether compiler catches assignment to __debug__"
+ 
+ try:
+ compile('__debug__ = 1', '?', 'single')
+ except SyntaxError:
+ pass
+ 
+ import __builtin__
+ setattr(__builtin__, '__debug__', 'sure')
+ 
+ if verbose:
 print 'Running tests on argument handling'
 
***************
*** 22,26 ****
 pass
 
! print "testing complex args"
 
 def comp_args((a, b)):
--- 33,38 ----
 pass
 
! if verbose:
! print "testing complex args"
 
 def comp_args((a, b)):

AltStyle によって変換されたページ (->オリジナル) /