Message7650
Fixing this would require breaking some tests we take from cpython.
The code reads
/////////
public void readonlyAttributeError(String name) {
// XXX: Should be an AttributeError but CPython throws TypeError for read only
// member descriptors (in structmember.c::PyMember_SetOne), which is expected by a
// few tests. fixed in py3k: http://bugs.python.org/issue1687163
throw Py.TypeError("readonly attribute");
}
/////
The problem is described in detail in this bug
Inconsistent Exceptions for Readonly Attributes
http://bugs.python.org/issue1687163
So we won't be able to fix this in 2.x without breaking tests.
What problems does this create for you?
Can you change your exception handling slightly to work around it? i.e.
try:
A().attr = 2
except (AttributeError, TypeError):
print "That was a read-only attribute"
or even
try:
A().attr = 2
except TypeError, t:
if t.message == "readonly attribute":
raise AttributeError(t) |
|
Date |
User |
Action |
Args |
2013-02-09 14:36:37 | amak | set | messageid: <1360420597.44.0.314292602638.issue1985@psf.upfronthosting.co.za> |
2013-02-09 14:36:37 | amak | set | recipients:
+ amak, mete0r |
2013-02-09 14:36:37 | amak | link | issue1985 messages |
2013-02-09 14:36:37 | amak | create | |
|