Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyStructList is not pickleable, which breaks pickling for any Struct with a list field #273

Closed
AdamGlustein opened this issue Jun 10, 2024 · 0 comments · Fixed by #285
Closed
Assignees
Labels
type: bug Concrete, reproducible bugs

Comments

@AdamGlustein
Copy link
Collaborator

Describe the bug

The newly implemented PyStructList class is not pickleable, which causes any csp.Struct with a list field to also become non-pickleable.

To Reproduce

import csp
import pickle
from typing import List

class Foo(csp.Struct):
    a : List[int]

f = Foo(a=[1,2,3])
u = pickle.dumps(f)

Expected behavior

The type should be made pickleable just as any Python object would be pickled.

Error Message

Traceback (most recent call last):
  File "ex_foo.py", line 9, in <module>
    u = pickle.dumps(f)
_pickle.PicklingError: Can't pickle <class '_cspimpl.PyStructList'>: import of module '_cspimpl' failed

Runtime Environment

0.0.4
3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:36:13) [GCC 12.3.0]
linux

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Concrete, reproducible bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants