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: Read-only property attributes raise wrong exception
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: barry Nosy List: barry
Priority: normal Keywords:

Created on 2005-04-16 23:16 by barry, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg25046 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2005-04-16 23:16
In
http://mail.python.org/pipermail/python-dev/2005-April/052681.html
I describe how attributes defined as properties raise
inconsistent errors depending on whether the property
is defined in C or Python.  By default in C, you'll get
a TypeError while in Python you'll get an AttributeError.

I think both should raise AttributeErrors. Here is a
patch against Python 2.4 which should be ported to 2.5
(and possibly 2.3 if we care).
msg25047 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2005-04-16 23:23
Logged In: YES 
user_id=12800

Well, I was going to attach a patch, but it seems SF is
borked and won't let me upload anything (yes the stupid
checkbox was checked).  The patch is simple though: change
PyExc_TypeError to PyExc_AttributeError on lines 147 and 202
in Objects/descrobject.c (rev 2.38)
msg25048 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2005-04-21 13:18
Logged In: YES 
user_id=12800

The change is in 2.5 and will /not/ be backported to 2.4.
History
Date User Action Args
2022-04-11 14:56:10adminsetgithub: 41869
2005-04-16 23:16:50barrycreate