[Patches] [ python-Patches-1512942 ] Improves an error message from setattr

SourceForge.net noreply at sourceforge.net
Thu Jun 29 20:07:41 CEST 2006


Patches item #1512942, was opened at 2006-06-26 15:47
Message generated for change (Comment added) made by belopolsky
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1512942&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 2.5
Status: Open
Resolution: None
>Priority: 3
Submitted By: Alexander Belopolsky (belopolsky)
Assigned to: Nobody/Anonymous (nobody)
Summary: Improves an error message from setattr

Initial Comment:
Fixes Bugs item #1506776

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

>Comment By: Alexander Belopolsky (belopolsky)
Date: 2006-06-29 14:07

Message:
Logged In: YES 
user_id=835142

I did not think of the that case.

It looks like there is no easy way to distinguish the slots
and no slots case in PyObject_GenericSetAttr.

I think the proper fix will involve not filling tp_setattro
with PyObject_GenericSetAttr in the presence of slots, but
use a function that is optimized for that case.

Can anyone suggest a simpler fix?

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

Comment By: Armin Rigo (arigo)
Date: 2006-06-28 06:36

Message:
Logged In: YES 
user_id=4771

The error message can still be wrong.  For example, in the
following situation:

  class X(object):
      __slots__ = ['a']
  X().b = 5

Then the original message -- no attribute 'b' -- was correct.
With this patch Python now wrongly tells you that 'X' object
has only read-only attributes.

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

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


More information about the Patches mailing list