Skip to content

Commit 2a041ae

Browse files
authored
BUG: Fix getstate compatibility (#84)
1 parent 4d623f4 commit 2a041ae

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

python/xoscar/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def __aiter__(self):
325325

326326
def __getstate__(self):
327327
# Transfer gc destroy during serialization.
328-
state = dict(**super().__getstate__())
328+
state = self.__dict__.copy()
329329
state["_gc_destroy"] = True
330330
self._gc_destroy = False
331331
return state

python/xoscar/tests/test_generator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import asyncio
16+
import pickle
1617
import time
1718

1819
import pytest
@@ -161,6 +162,7 @@ async def test_generator():
161162
assert len(all_gen) == 0
162163

163164
r = await superivsor_actor.with_exception()
165+
pickle.loads(pickle.dumps(r))
164166
del r
165167
await asyncio.sleep(0)
166168
all_gen = await superivsor_actor.get_all_generators()

0 commit comments

Comments
 (0)