On 6/19/06, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> On 6/14/06, Alexander Belopolsky <[EMAIL PROTECTED]> wrote:
> > ... It would be better to change the message
> > to "'Foo' object has only read-only attributes (assign to .bar)" as in
> > the case tp_setattro == tp_setattr == NULL in  PyObject_SetAttr .
>
> I agree. Can you submit a patch to SF please?
>
Please see:

https://sourceforge.net/tracker/index.php?func=detail&aid=1512942&group_id=5470&atid=305470

I've tested the patch by setting tp_setattr to 0 in Xxo_Type.  With the patch:

>>> import xx
>>> x = xx.new()
>>> x.a = 2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'xxmodule.Xxo' object has only read-only attributes
(assign to .a)
>>> del x.a
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'xxmodule.Xxo' object has only read-only attributes (del .a)

Note that this log reveals a small inaccuracy in xxmodule.c : the
module name is "xx," but Xxo type name is "xxmodule.Xxo."  Should I
submit a patch fixing that?
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to