[issue45524] Cross-module dataclass inheritance breaks get_type_hints
Alex Waygood
report at bugs.python.org
Fri Oct 22 07:09:29 EDT 2021
Alex Waygood <Alex.Waygood at Gmail.com> added the comment:
@Nikita, I had a go at writing some more rigorous tests regarding this issue. I found the same thing you did -- the issue seems:
* Isolated to dataclasses specifically (doesn't occur with TypedDicts, standard classes or NamedTuples)
* Isolated to the __init__ method of dataclasses
* Only occurs when you *subclass* a dataclass defined in another module.
My tests are in these two files on my cpython fork:
* https://github.com/AlexWaygood/cpython/blob/forward-annotations-bpo-45524/Lib/test/test_future_annotations.py
* https://github.com/AlexWaygood/cpython/blob/forward-annotations-bpo-45524/Lib/test/_typing_imports_helper.py
(I'm not proposing adding two new files to the cpython test suite -- just put the tests in new files so that I could isolate the new tests from the rest of the test suite and understand the problem better.)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45524>
_______________________________________
More information about the Python-bugs-list
mailing list