[issue46938] dataclass __post_init__ recursion

2022-03-06 Thread Eric V. Smith
Eric V. Smith added the comment: Yeah, I've come to the conclusion that it's not so simple, either. I'm also thinking that advising to call the base __init__ is a mistake. -- ___ Python tracker

[issue46938] dataclass __post_init__ recursion

2022-03-06 Thread Bar Harel
Bar Harel added the comment: Actually I'm not sure if the fix is so simple. What happens if B does not inherit from dataclass, but still inherits from A? Do we want to use the new __post_init__? I would assume we do, meaning we don't necessarily want to attach the __post_init__ to the

[issue46938] dataclass __post_init__ recursion

2022-03-06 Thread Bar Harel
Bar Harel added the comment: @Eric, I can easily fix it if you wish :-) Just wondered if it's intended or not, as it looked like a bug but the documentation was somewhat endorsing it and I got confused. Either case, a simple fix. -- ___ Python

[issue46938] dataclass __post_init__ recursion

2022-03-06 Thread Eric V. Smith
Eric V. Smith added the comment: I think this is a bug in the code. I'll have a PR ready shortly. But since it's a non-trivial change, I'm going to target it for 3.11 only. -- assignee: docs@python -> eric.smith versions: -Python 3.10, Python 3.9

[issue46938] dataclass __post_init__ recursion

2022-03-06 Thread Alex Waygood
Change by Alex Waygood : -- nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46938] dataclass __post_init__ recursion

2022-03-06 Thread Bar Harel
New submission from Bar Harel : Not sure if a continuance of https://bugs.python.org/issue44365 or not, but the suggestion to call super().__init__() in __post__init__ will cause infinite recursion if the superclass also contains __post__init__: >>> @d ... class A: ... test: int ... def