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

SourceForge.net noreply at sourceforge.net
Wed Feb 16 22:58:10 CET 2005


Bugs item #1124295, was opened at 2005-02-16 16:34
Message generated for change (Comment added) made by tim_one
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1124295&group_id=5470

Category: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
>Priority: 8
Submitted By: Tres Seaver (tseaver)
>Assigned to: Tim Peters (tim_one)
Summary: Function's __name__ no longer accessible in restricted mode

Initial Comment:
This change breaks an obscure bit of Zope's security
machinery,
which uses the __name__ of a function to construct the
synthetic
attribute name under which the roles for a method are
stored.

$ ../bin/python2.3
Python 2.3.4 (#3, Jan 27 2005, 10:46:13)
[GCC 3.3.4 (Debian 1:3.3.4-9ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> code = """... def func():
...     pass
... print func.__name__
... """
>>> exec code
func
>>> globs = {'__builtins__':{}}
>>> exec code in globs
func
>>> ^D

$ ../bin/python2.4
Python 2.4 (#1, Feb 16 2005, 13:11:02)
[GCC 3.3.4 (Debian 1:3.3.4-9ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> code = """... def func():
...     pass
... print func.__name__
... """
>>> exec code
func
>>> globs = {'__builtins__':{}}
>>> exec code in globs
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<string>", line 3, in ?
RuntimeError: function attributes not accessible in
restricted mode
>>> ^D

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2005-02-16 16:58

Message:
Logged In: YES 
user_id=31435

Assigned to me, and boosted priority, since this should be 
addressed for 2.4.1.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1124295&group_id=5470


More information about the Python-bugs-list mailing list