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: Closed Resolution: Fixed Priority: 8 Submitted By: Tres Seaver (tseaver) Assigned to: Michael Hudson (mwh) 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-17 10:55 Message: Logged In: YES user_id=31435 Thanks, Michael! It _looked_ like a copy-paste glitch <wink>. I've confirmed that the specific failing Zope test works with current release24-maint branch. ---------------------------------------------------------------------- Comment By: Michael Hudson (mwh) Date: 2005-02-17 05:44 Message: Logged In: YES user_id=6656 Fixed on HEAD in Objects/funcobject.c revision 2.68 Lib/test/test_funcattrs.py revision 1.17 and on 24-maint in Objects/funcobject.c revision 2.67.2.1 Lib/test/test_funcattrs.py revision 1.16.2.1 Copy and paste are evil... ---------------------------------------------------------------------- Comment By: Michael Hudson (mwh) Date: 2005-02-17 05:32 Message: Logged In: YES user_id=6656 Oops. My fault, easy to fix. ---------------------------------------------------------------------- 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 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com