[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-03-21 Thread Eric V. Smith

Eric V. Smith  added the comment:

Thanks again for the bug report. This ended up being a simple fix, but an 
important one.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-03-21 Thread Eric V. Smith

Eric V. Smith  added the comment:


New changeset 22136c94b6e43c8c584a54f3a513b83b753b96ee by Eric V. Smith (Miss 
Islington (bot)) in branch '3.7':
bpo-32896: Fix error when subclassing a dataclass with a field that uses a 
default_factory (GH-6170) (GH-6171)
https://github.com/python/cpython/commit/22136c94b6e43c8c584a54f3a513b83b753b96ee


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-03-20 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5926

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-03-20 Thread Eric V. Smith

Eric V. Smith  added the comment:


New changeset 8f6eccdc64cab735c47620fea948e64b19f83684 by Eric V. Smith in 
branch 'master':
bpo-32896: Fix error when subclassing a dataclass with a field that uses a 
default_factory (GH-6170)
https://github.com/python/cpython/commit/8f6eccdc64cab735c47620fea948e64b19f83684


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-03-20 Thread Eric V. Smith

Change by Eric V. Smith :


--
keywords: +patch
pull_requests: +5925
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-03-20 Thread Eric V. Smith

Change by Eric V. Smith :


--
priority: deferred blocker -> release blocker
versions: +Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-02-26 Thread Eric V. Smith

Change by Eric V. Smith :


--
priority: release blocker -> deferred blocker

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-02-21 Thread Eric V. Smith

Change by Eric V. Smith :


--
nosy: +ned.deily
priority: normal -> release blocker

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-02-21 Thread Eric V. Smith

Eric V. Smith  added the comment:

That's a great bug report. Thanks for the tiny code to replicate it.

It turns out the code isn't quite doing what I thought. I'll have to give some 
thought to exactly how I'm going to handle this without breaking other cases, 
but I should have it fixed soon.

Thanks again.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-02-21 Thread Eric V. Smith

Change by Eric V. Smith :


--
assignee:  -> eric.smith
components: +Library (Lib)
type: crash -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-02-21 Thread Ned Deily

Change by Ned Deily :


--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-02-21 Thread John Didion

New submission from John Didion :

> @dataclass
> class Foo:
>  x: dict = field(default_factory=dict)

> @dataclass
> class Bar(Foo):
>   y: int = 1

> @dataclass
> class Baz(Foo):
>   def blorf(self):
> print('hello')

> Foo().x
{}

> Bar().x
{}

> Baz().x

Traceback (most recent call last):
  File "", line 1, in 
TypeError: __init__() missing 1 required positional argument: 'x'

---

I understand that this is desired behavior when the subclass contains 
non-default attributes. But subclasses that define no additional attributes 
should work just the same as those that define only additional default 
attributes.

A similar issue was raised and dismissed when dataclasses was in development on 
GitHub: https://github.com/ericvsmith/dataclasses/issues/112, but that only 
concerned the case of subclasses defining non-default attributes.

--
messages: 312496
nosy: John Didion
priority: normal
severity: normal
status: open
title: Error when subclassing a dataclass with a field that uses a 
defaultfactory
type: crash
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com