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

BUG: Fix getstate compatibility #84

Merged
merged 2 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/xoscar/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def __aiter__(self):

def __getstate__(self):
# Transfer gc destroy during serialization.
state = dict(**super().__getstate__())
state = self.__dict__.copy()
state["_gc_destroy"] = True
self._gc_destroy = False
return state
Expand Down
2 changes: 2 additions & 0 deletions python/xoscar/tests/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import asyncio
import pickle
import time

import pytest
Expand Down Expand Up @@ -161,6 +162,7 @@ async def test_generator():
assert len(all_gen) == 0

r = await superivsor_actor.with_exception()
pickle.loads(pickle.dumps(r))
del r
await asyncio.sleep(0)
all_gen = await superivsor_actor.get_all_generators()
Expand Down