From 8d60d392c5d9b00560c4a9418902f12126dae125 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 18 Jan 2015 13:25:49 -0500 Subject: Collect all the nudgy environment checks into coverage.env --- coverage/backward.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'coverage/backward.py') diff --git a/coverage/backward.py b/coverage/backward.py index 9a3c9f7c..5a323659 100644 --- a/coverage/backward.py +++ b/coverage/backward.py @@ -7,6 +7,9 @@ import sys +from coverage import env + + # Pythons 2 and 3 differ on where to get StringIO. try: from cStringIO import StringIO @@ -63,7 +66,7 @@ else: # Python 3.x is picky about bytes and strings, so provide methods to # get them right, and make them no-ops in 2.x -if sys.version_info >= (3, 0): +if env.PY3: def to_bytes(s): """Convert string `s` to bytes.""" return s.encode('utf8') -- cgit v1.2.1