From 13ed869c6be652f0b7729cebb26583d03c7ab12a Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 14 Mar 2017 13:40:14 -0400 Subject: Minimal IronPython support. IronPython is weird: 2.7.7 has "str is unicode", and unicode.encode produces unicode! f_lasti is missing, and frame globals are missing. --- coverage/python.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'coverage/python.py') diff --git a/coverage/python.py b/coverage/python.py index f75be60a..9418c386 100644 --- a/coverage/python.py +++ b/coverage/python.py @@ -26,7 +26,13 @@ def read_python_source(filename): """ with open(filename, "rb") as f: - return f.read().replace(b"\r\n", b"\n").replace(b"\r", b"\n") + source = f.read() + + if env.IRONPYTHON: + # IronPython reads Unicode strings even for "rb" files. + source = bytes(source) + + return source.replace(b"\r\n", b"\n").replace(b"\r", b"\n") @contract(returns='unicode') -- cgit v1.2.1