Refactor use of basestring to use exec() on attempted assignment of
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 15 Apr 2010 01:06:53 +0000 (01:06 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 15 Apr 2010 01:06:53 +0000 (01:06 +0000)
basestring to an internal variable (which we thenuse in a common
is_basestring() utility function), to avoid triggering the basestring fixer.

git-svn-id: http://scons.tigris.org/svn/scons/trunk@4786 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/compat/_scons_shlex.py

index 6ed39cfa1109d151a61e25815e72348cd5f81b1c..2a748ff493b86df6408a08051cc8655d66fbb78d 100644 (file)
@@ -23,14 +23,13 @@ class deque:
         return self.data.pop(0)
 
 try:
-    basestring
+    # exec() the assignment to avoid the basestring fixer.
+    exec('_basestring = basestring')
 except NameError:
     import types
-    def is_basestring(s):
-        return isinstance(s, str)
-else:
-    def is_basestring(s):
-        return isinstance(s, basestring)
+    _basestring = str
+def is_basestring(s):
+    return isinstance(s, _basestring)
 
 # Use the "imp" module to protect the imports below from fixers.
 try: