mirror of
https://github.com/wassname/ray.git
synced 2026-07-03 07:27:37 +08:00
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:
@@ -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.
|
||||
|
||||
@@ -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__]))
|
||||
|
||||
Reference in New Issue
Block a user