diff options
author | William Deegan <bill@baddogconsulting.com> | 2017-03-13 13:53:31 -0400 |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2017-03-13 13:53:31 -0400 |
commit | 5967b4a81b1d2b0c431ac212e36b8ccd1883cc92 (patch) | |
tree | 25ff7a487fc3c7806e923b1c9f1942b6e2379a81 /test/option | |
parent | 0238f00719cfc080ec7fdcb26c797824cb2f64f8 (diff) | |
download | scons-5967b4a81b1d2b0c431ac212e36b8ccd1883cc92.tar.gz |
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/option')
-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 4d942cf2..cb9d22c7 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 |