mirror of
https://github.com/wassname/ray.git
synced 2026-08-01 12:51:09 +08:00
Fix segmentation fault when calling ray.put on a dictionary with object keys (#548)
* fix segfault when serializing dict key * fix style * fix test * Fix linting.
This commit is contained in:
committed by
Philipp Moritz
parent
3c5375345f
commit
e2e9e4ce6f
+10
-3
@@ -89,8 +89,14 @@ COMPLEX_OBJECTS = [
|
||||
|
||||
|
||||
class Foo(object):
|
||||
def __init__(self):
|
||||
pass
|
||||
def __init__(self, value=0):
|
||||
self.value = value
|
||||
|
||||
def __hash__(self):
|
||||
return hash(self.value)
|
||||
|
||||
def __eq__(self, other):
|
||||
return other.value == self.value
|
||||
|
||||
|
||||
class Bar(object):
|
||||
@@ -139,7 +145,8 @@ TUPLE_OBJECTS = [(obj,) for obj in BASE_OBJECTS]
|
||||
DICT_OBJECTS = ([{obj: obj} for obj in PRIMITIVE_OBJECTS
|
||||
if (obj.__hash__ is not None and
|
||||
type(obj).__module__ != "numpy")] +
|
||||
[{0: obj} for obj in BASE_OBJECTS])
|
||||
[{0: obj} for obj in BASE_OBJECTS] +
|
||||
[{Foo(123): Foo(456)}])
|
||||
|
||||
RAY_TEST_OBJECTS = BASE_OBJECTS + LIST_OBJECTS + TUPLE_OBJECTS + DICT_OBJECTS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user