[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Eric V. Smith
Change by Eric V. Smith : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Eric V. Smith
Eric V. Smith added the comment: New changeset 3d41f482594b6aab12a316202b3c06757262109a by Eric V. Smith (Miss Islington (bot)) in branch '3.7': bpo-33100: Dataclasses now handles __slots__ and default values correctly. (GH-6152) (GH-6153)

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Eric V. Smith
Eric V. Smith added the comment: New changeset 7389fd935c95b4b6f094312294e703ee0de18719 by Eric V. Smith in branch 'master': bpo-33100: Dataclasses now handles __slots__ and default values correctly. (GH-6152)

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread miss-islington
Change by miss-islington : -- pull_requests: +5911 ___ Python tracker ___

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Eric V. Smith
Change by Eric V. Smith : -- keywords: +patch pull_requests: +5910 stage: -> patch review ___ Python tracker ___

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Eric V. Smith
Eric V. Smith added the comment: Thanks, but I'm already looking at this in the context of a different bug. -- ___ Python tracker

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Adrian Stachlewski
Adrian Stachlewski added the comment: There's also another major problem. Because Base.x has value, __init__ is not prepared correctly (member_descriptor is passed as default). @dataclass class Base: __slots__ = ('x',) x: Any Base() # No TypeError

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Eric V. Smith
Eric V. Smith added the comment: My point is that the problem is that after: @dataclass class Base: __slots__ = ('x',) x: Any Base.x has a value (it's the member_descriptor for x). That's what's causing the problem that when adding a field to the derived class, it

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Adrian Stachlewski
Adrian Stachlewski added the comment: I don't really get your point. @dataclass class Base: __slots__ = ('x',) x: Any This case is described in PEP 557 as correct, so I don't understand why you want to generate error. Also inheritance without defining

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Eric V. Smith
Eric V. Smith added the comment: This is the same reason that this fails: class Base: __slots__ = ('x',) x = 3 with: ValueError: 'x' in __slots__ conflicts with class variable In the dataclasses case, the error needs to be improved, and moved to when the base

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-18 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> eric.smith nosy: +eric.smith ___ Python tracker ___

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-18 Thread Adrian Stachlewski
New submission from Adrian Stachlewski : I've tried to declare two classes @dataclass class Base: __slots__ = ('x',) x: Any @dataclass class Derived(Base): x: int y: int As long as I correctly understood PEP 557 (inheritance part), changing type