This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: "__getattr__" can't be a descriptor
Type: behavior Stage:
Components: Interpreter Core Versions: Python 2.4, Python 2.7, Python 2.6, Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Carl.Friedrich.Bolz, arigo, benjamin.peterson, zaur, zseil
Priority: low Keywords: patch

Created on 2008-10-29 17:46 by arigo, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
x.py arigo, 2008-10-29 17:46 The __getattr__ case fails
getattr_hooks_25.diff zseil, 2008-11-17 16:22
getattr_hooks_trunk.diff zseil, 2008-11-17 16:22
getattr_hooks_24.diff zseil, 2008-11-17 23:18 security fix for Python 2.4
Messages (6)
msg75322 - (view) Author: Armin Rigo (arigo) * (Python committer) Date: 2008-10-29 17:46
The attached example works in the __add__ and __getattribute__ cases on
CPython, but fails in the __getattr__ case.  All three cases work as the
semantics say they should on Jython, IronPython and PyPy.  It's
admittedly an obscure use case. 

There is no reason that __getattr__ should behave differently.  The
behavior of __add__ and __getattribute__ is the "correct" one, according
to the rule that special methods are bound (with __get__) before they
are called.
msg75440 - (view) Author: Zaur Shibzoukhov (zaur) Date: 2008-11-01 08:09
It's the issue for python 3.0 too
msg75971 - (view) Author: Ziga Seilnacht (zseil) * (Python committer) Date: 2008-11-17 16:22
Here is a patch for trunk and 2.5 version. It also contains a fix for
another crasher (see the tests). I only tested the 2.5 patch, because I
don't have the tools for the trunk installed.
msg75987 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-11-17 22:39
Thanks for the patch! Fixed in r67246.
msg75992 - (view) Author: Ziga Seilnacht (zseil) * (Python committer) Date: 2008-11-17 23:18
Here is another patch, for Python 2.4, which contains only the security
fix. Benjamin, will you also commit these backports?
msg75993 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-11-17 23:35
Backported to 2.4 in r67250 and 2.5 in r67251.
History
Date User Action Args
2022-04-11 14:56:40adminsetgithub: 48480
2008-11-17 23:35:32benjamin.petersonsetmessages: + msg75993
2008-11-17 23:18:04zseilsetfiles: + getattr_hooks_24.diff
messages: + msg75992
2008-11-17 22:39:55benjamin.petersonsetstatus: open -> closed
nosy: + benjamin.peterson
resolution: fixed
messages: + msg75987
2008-11-17 16:22:47zseilsetfiles: + getattr_hooks_trunk.diff
2008-11-17 16:22:22zseilsetfiles: + getattr_hooks_25.diff
nosy: + zseil
messages: + msg75971
keywords: + patch
2008-11-01 08:09:32zaursetnosy: + zaur
messages: + msg75440
2008-10-29 17:46:01arigocreate