New submission from Bastien Sevajol <[email protected]>:
Hello,
For following code:
```
import dataclasses
import typing
from datetime import datetime
@dataclasses.dataclass
class Foo:
datetime: typing.Optional[datetime] = None
print(dataclasses.fields(Foo)[0].type)
```
`datetime` `Foo` attribute have `NoneType` type. Problem come from `datetime`
attribute name is already used by the `from datetime import datetime` import.
I'm not sure if it is a bug or a strange behavior but it seems not regular.
Tested on python 3.8.0a2 with same result.
----------
components: Extension Modules
messages: 338354
nosy: Bastien Sevajol
priority: normal
severity: normal
status: open
title: Wrong type when missname dataclass attribute with existing variable name
type: behavior
versions: Python 3.7
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36363>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com