We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Traceback (most recent call last): File "/tmp/test.py", line 38, in main print(t.to_json()) ^^^^^^^^^^^ File "/lib64/python3.11/site-packages/dataclasses_json/api.py", line 37, in to_json return json.dumps(self.to_dict(encode_json=False), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/lib64/python3.11/site-packages/dataclasses_json/api.py", line 73, in to_dict return _asdict(self, encode_json=encode_json) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/lib64/python3.11/site-packages/dataclasses_json/core.py", line 417, in _asdict value = _asdict( ^^^^^^^^ File "/lib64/python3.11/site-packages/dataclasses_json/core.py", line 439, in _asdict return copy.deepcopy(obj) ^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.11/copy.py", line 161, in deepcopy rv = reductor(4) ^^^^^^^^^^^ TypeError: cannot pickle '_asyncio.Task' object
@dataclass class MyTask(DataClassJsonMixin): name: str task: asyncio.Task|None = field(default=None, metadata=config(exclude=lambda x:True)) async def main(): t = MyTask("test", asyncio.create_task(asyncio.sleep(1))) print(t.to_json()) asyncio.run(main())
I'd expect that it prints {name: "test"}
{name: "test"}
Python 3.11.6
dataclasses-json==0.6.6
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
Code snippet that reproduces the issue
Describe the results you expected
I'd expect that it prints
{name: "test"}
Python version you are using
Python 3.11.6
Environment description
dataclasses-json==0.6.6
The text was updated successfully, but these errors were encountered: