diff options
author | Michael W. Hudson <mwh@python.net> | 2005-02-17 10:43:12 (GMT) |
---|---|---|
committer | Michael W. Hudson <mwh@python.net> | 2005-02-17 10:43:12 (GMT) |
commit | 8ed7e2e2db9161379f001e010d5de5d775e397b9 (patch) | |
tree | 44f7df467f14a09ff386a27960ee9921611789d3 /Lib/test | |
parent | 8d751fa05e358e1b7bace33196feb4a45547dab3 (diff) | |
download | cpython-8ed7e2e2db9161379f001e010d5de5d775e397b9.zip cpython-8ed7e2e2db9161379f001e010d5de5d775e397b9.tar.gz cpython-8ed7e2e2db9161379f001e010d5de5d775e397b9.tar.bz2 |
Backport: 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')
-rw-r--r-- | Lib/test/test_funcattrs.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_funcattrs.py b/Lib/test/test_funcattrs.py index 1acfeb5..7a083b7 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(): |