[ python-Bugs-1184449 ] Read-only property attributes raise wrong exception

SourceForge.net noreply at sourceforge.net
Mon Apr 18 19:05:33 CEST 2005


Bugs item #1184449, was opened at 2005-04-16 18:16
Message generated for change (Settings changed) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1184449&group_id=5470

Category: Python Interpreter Core
Group: Python 2.5
Status: Open
>Resolution: Accepted
Priority: 5
Submitted By: Barry A. Warsaw (bwarsaw)
>Assigned to: Barry A. Warsaw (bwarsaw)
Summary: Read-only property attributes raise wrong exception

Initial Comment:
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).


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

Comment By: Barry A. Warsaw (bwarsaw)
Date: 2005-04-16 18:23

Message:
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)

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

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


More information about the Python-bugs-list mailing list