diff options
Diffstat (limited to 'accessible/tests/browser/python_runner_wsh.py')
-rw-r--r-- | accessible/tests/browser/python_runner_wsh.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/accessible/tests/browser/python_runner_wsh.py b/accessible/tests/browser/python_runner_wsh.py index 488051240f..2686967cfb 100644 --- a/accessible/tests/browser/python_runner_wsh.py +++ b/accessible/tests/browser/python_runner_wsh.py @@ -9,6 +9,7 @@ It is intended to be called from JS browser tests. """ import json +import math import os import sys import traceback @@ -83,6 +84,9 @@ def web_socket_transfer_data(request): exec(code, namespace) # Run the function we just defined. ret = namespace["run"]() + if isinstance(ret, float) and math.isnan(ret): + # NaN can't be serialized by JSON. + ret = None send("return", ret) except Exception: send("exception", traceback.format_exc()) |