[Python-checkins] CVS: python/dist/src/Lib/test test_compile.py,1.8,1.9
Jeremy Hylton
jhylton@users.sourceforge.net
Fri, 09 Nov 2001 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)):