summaryrefslogtreecommitdiff
path: root/Lib/test/test_funcattrs.py
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2005-02-17 10:37:21 +0000
committerMichael W. Hudson <mwh@python.net>2005-02-17 10:37:21 +0000
commit4a329b6a860f0ac4ee9eb6c07e92406f7234073f (patch)
tree1db49a279e3e3ca5a3b2236d6c1f9d1b2e75d757 /Lib/test/test_funcattrs.py
parent99787bdc5398ce6a182adea7d8cc2b36a2c908b8 (diff)
downloadcpython-4a329b6a860f0ac4ee9eb6c07e92406f7234073f.tar.gz
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 :)
Diffstat (limited to 'Lib/test/test_funcattrs.py')
-rw-r--r--Lib/test/test_funcattrs.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_funcattrs.py b/Lib/test/test_funcattrs.py
index 1acfeb5e65..7a083b70df 100644
--- a/Lib/test/test_funcattrs.py
+++ b/Lib/test/test_funcattrs.py
@@ -276,6 +276,9 @@ def test_func_name():
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():