[Python-checkins] python/dist/src/Lib/test test_funcattrs.py, 1.16, 1.17

mwh at users.sourceforge.net mwh at users.sourceforge.net
Thu Feb 17 11:37:30 CET 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3732/Lib/test

Modified Files:
	test_funcattrs.py 
Log Message:
Fix

[ 1124295 ] Function's __name__ no longer accessible in restricted mode

which I introduced with a bit of mindless copy-paste when making
__name__ writable.  You can't assign to __name__ in restricted mode,
which I'm going to pretend was intentional :)


Index: test_funcattrs.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_funcattrs.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- test_funcattrs.py	28 Oct 2004 16:31:59 -0000	1.16
+++ test_funcattrs.py	17 Feb 2005 10:37:21 -0000	1.17
@@ -276,6 +276,9 @@
     verify(f.func_name == "h")
     cantset(f, "func_globals", 1)
     cantset(f, "__name__", 1)
+    # test that you can access func.__name__ in restricted mode
+    s = """def f(): pass\nf.__name__"""
+    exec s in {'__builtins__':{}}
 
 
 def test_func_code():



More information about the Python-checkins mailing list