[issue35510] pickling derived dataclasses

2018-12-16 Thread Satrajit S Ghosh
Satrajit S Ghosh added the comment: Thank you. -- stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Python-bugs

[issue35510] pickling derived dataclasses

2018-12-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Dataclasses are pickled by name, as well as other classes. Pickling classes which can not be accessed by name is not supported. -- ___ Python tracker

[issue35510] pickling derived dataclasses

2018-12-16 Thread Satrajit S Ghosh
Satrajit S Ghosh added the comment: thank you + serhiy.storchaka while that works in an interactive namespace, it fails in the following setting, which is closer to my dynamic use case. ``` class A: def __init__(self, fields=None): self.B = dc.make_dataclass('B', fields or [])

[issue35510] pickling derived dataclasses

2018-12-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: You need to set the __module__ attribute. B.__module__ = __name__ -- nosy: +serhiy.storchaka ___ Python tracker ___ __

[issue35510] pickling derived dataclasses

2018-12-15 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue35510] pickling derived dataclasses

2018-12-15 Thread Satrajit S Ghosh
New submission from Satrajit S Ghosh : I'm not sure if this is intended behavior or an error. I'm creating dataclasses dynamically and trying to pickle those classes or objects containing instances of those classes. This was resulting in an error, so I trimmed it down to this example. ``` im