[New-bugs-announce] [issue12766] strange interaction between __slots__ and class-level attributes

Antoine Pitrou report at bugs.python.org
Wed Aug 17 00:44:42 CEST 2011


New submission from Antoine Pitrou <pitrou at free.fr>:

>>> class Foo:
...    __slots__ = ['foo']
...    foo = None
... 
>>> x = Foo()
>>> x.foo
>>> x.foo = 5
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Foo' object attribute 'foo' is read-only

----------
components: Interpreter Core
messages: 142232
nosy: benjamin.peterson, pitrou
priority: normal
severity: normal
status: open
title: strange interaction between __slots__ and class-level attributes
type: behavior
versions: Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12766>
_______________________________________


More information about the New-bugs-announce mailing list