diff options
author | William Deegan <bill@baddogconsulting.com> | 2017-03-13 17:53:31 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2017-03-13 17:53:31 (GMT) |
commit | 13cb7953e6d2057252239a649364255280d69cfb (patch) | |
tree | 25ff7a487fc3c7806e923b1c9f1942b6e2379a81 /test | |
parent | b46674b1dfcbdc9a1565ed989143dd7c70ef9b3d (diff) | |
download | SCons-13cb7953e6d2057252239a649364255280d69cfb.zip SCons-13cb7953e6d2057252239a649364255280d69cfb.tar.gz SCons-13cb7953e6d2057252239a649364255280d69cfb.tar.bz2 |
Fix name shadowing trap brought to light by py3s changes in module import see: http://python-notes.curiousefficiency.org/en/latest/python_concepts/import_traps.html#the-name-shadowing-trap
Diffstat (limited to 'test')
-rw-r--r-- | test/option/option_profile.py (renamed from test/option/profile.py) | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/test/option/profile.py b/test/option/option_profile.py index 4d942cf..cb9d22c 100644 --- a/test/option/profile.py +++ b/test/option/option_profile.py @@ -25,14 +25,18 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import sys -import io -_StringIO = io.StringIO -# TODO(2.6): In 2.6 and beyond, the io.StringIO.write() method -# requires unicode strings. This subclass can probably be removed -# when we drop support for Python 2.6. -class StringIO(_StringIO): - def write(self, s): - _StringIO.write(self, unicode(s)) + +if sys.version_info[0] < 3: + import io + _StringIO = io.StringIO + # TODO(2.6): In 2.6 and beyond, the io.StringIO.write() method + # requires unicode strings. This subclass can probably be removed + # when we drop support for Python 2.6. + class StringIO(_StringIO): + def write(self, s): + _StringIO.write(self, unicode(s)) +else: + from io import StringIO import TestSCons |