Issue 4230: "getattr" can't be a descriptor (original) (raw)

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:40 admin set github: 48480
2008-11-17 23:35:32 benjamin.peterson set messages: +
2008-11-17 23🔞04 zseil set files: + getattr_hooks_24.diffmessages: +
2008-11-17 22:39:55 benjamin.peterson set status: open -> closednosy: + benjamin.petersonresolution: fixedmessages: +
2008-11-17 16:22:47 zseil set files: + getattr_hooks_trunk.diff
2008-11-17 16:22:22 zseil set files: + getattr_hooks_25.diffnosy: + zseilmessages: + keywords: + patch
2008-11-01 08:09:32 zaur set nosy: + zaurmessages: +
2008-10-29 17:46:01 arigo create