diff --git a/python/ray/function_manager.py b/python/ray/function_manager.py index b42bdd842..f43fc8559 100644 --- a/python/ray/function_manager.py +++ b/python/ray/function_manager.py @@ -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. diff --git a/python/ray/tests/test_basic.py b/python/ray/tests/test_basic.py index 0d540faa3..46c1ff5a0 100644 --- a/python/ray/tests/test_basic.py +++ b/python/ray/tests/test_basic.py @@ -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__]))