A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-June/066572.html below:

[Python-Dev] Misleading error message from PyObject_GenericSetAttr

[Python-Dev] Misleading error message from PyObject_GenericSetAttr [Python-Dev] Misleading error message from PyObject_GenericSetAttrAlexander Belopolsky alexander.belopolsky at gmail.com
Mon Jun 26 21:54:49 CEST 2006
On 6/19/06, Guido van Rossum <guido at python.org> wrote:
> On 6/14/06, Alexander Belopolsky <alexander.belopolsky at gmail.com> 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?
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4