DAGDA SEARCH | Back to results | Support

Message 331914 - Python tracker

Source: https://bugs.python.org/msg331914

homepage

Message331914 ➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author satra
Recipients satra
Date 2018-12-16.03:22:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1544930541.77.0.788709270274.issue35510@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2018-12-16 03:22:21satrasetrecipients: + satra
2018-12-16 03:22:21satrasetmessageid: <1544930541.77.0.788709270274.issue35510@psf.upfronthosting.co.za>
2018-12-16 03:22:21satralinkissue35510 messages
2018-12-16 03:22:20satracreate
Supported by The Python Software Foundation,
Powered by Roundup Copyright © 1990-2022, Python Software Foundation
Legal Statements