diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-11-09 19:50:08 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-11-09 19:50:08 (GMT) |
commit | 778e26546284f956cbf8a85a8b7a0bf28c194410 (patch) | |
tree | c81d319729f7e05c96fb85d939edb8636240ca99 /Lib | |
parent | 734c7fb13165e9c299c2522f06da5b31a50af941 (diff) | |
download | cpython-778e26546284f956cbf8a85a8b7a0bf28c194410.zip cpython-778e26546284f956cbf8a85a8b7a0bf28c194410.tar.gz cpython-778e26546284f956cbf8a85a8b7a0bf28c194410.tar.bz2 |
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.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_compile.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index 9f20ba1..e976a30 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -1,6 +1,17 @@ from test_support import verbose, TestFailed 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' try: @@ -21,7 +32,8 @@ try: except SyntaxError: pass -print "testing complex args" +if verbose: + print "testing complex args" def comp_args((a, b)): print a,b |