Use UTF-8 for encoding of python code for collision hashing (#9586)

Co-authored-by: Arne Sachtler <arne.sachtler@dlr.de>
Co-authored-by: simon-mo <simon.mo@hey.com>
This commit is contained in:
Arne Sachtler
2020-07-21 22:16:54 +02:00
committed by GitHub
parent 75592e664f
commit 4a36f72ce1
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -120,7 +120,7 @@ class FunctionActorManager:
function_or_class.__name__ + ":" + string_file.getvalue())
# Return a hash of the identifier in case it is too large.
return hashlib.sha1(collision_identifier.encode("ascii")).digest()
return hashlib.sha1(collision_identifier.encode("utf-8")).digest()
def export(self, remote_function):
"""Pickle a remote function and export it to redis.
+8
View File
@@ -743,6 +743,14 @@ def test_object_id_backward_compatibility(ray_start_regular):
assert isinstance(object_ref, ray.ObjectRef)
def test_nonascii_in_function_body(ray_start_regular):
@ray.remote
def return_a_greek_char():
return "φ"
assert ray.get(return_a_greek_char.remote()) == "φ"
if __name__ == "__main__":
import pytest
sys.exit(pytest.main(["-v", __file__]))