Skip to content

Commit

Permalink
BUG: Fix getstate compatibility (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
codingl2k1 authored Jan 5, 2024
1 parent 4d623f4 commit 2a041ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
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

0 comments on commit 2a041ae

Please sign in to comment.