New submission from Satrajit S Ghosh <satrajit.gh...@gmail.com>:

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.

```
import pickle as pk
import dataclasses as dc

@dc.dataclass
class A:
     pass
pk.dumps(A)  # --> this is fine

B = dc.make_dataclass('B', [], bases=(A,))
pk.dumps(B)  # --> results in an error

# PicklingError: Can't pickle <class 'types.B'>: attribute lookup B on types 
failed
```

is this expected behavior? and if so, is there a way to create a dynamic 
dataclass that pickles?

----------
components: Library (Lib)
messages: 331914
nosy: satra
priority: normal
severity: normal
status: open
title: pickling derived dataclasses
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35510>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to