[issue36470] dataclasses replace raises an exception with an empty

2019-03-29 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +eric.smith

___
Python tracker 

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



[issue36470] dataclasses replace raises an exception with an empty

2019-03-29 Thread Greg Kuhn


New submission from Greg Kuhn :

I have a snippet below which runs fine on python 3.7.0 but raises a ValueError 
exception on 3.7.1. I believe it's related to 
https://bugs.python.org/issue33805.

The error: c:\python\lib\dataclasses.py:1219: ValueError

The script:

from dataclasses import replace, dataclass, InitVar

@dataclass
class Test:
a:int = 1
b:InitVar[int] = None

def __post_init__(self, b):
if b is not None:
self.a = b


if __name__ == '__main__':
t = Test()
t1 = Test(b=5)
assert t1.a == 5

t2 = replace(t1, **{})
print(t2)

--
components: Interpreter Core
messages: 339105
nosy: Greg Kuhn
priority: normal
severity: normal
status: open
title: dataclasses replace raises an exception with an empty
type: behavior
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