From: stevenknight Date: Thu, 15 Apr 2010 01:06:53 +0000 (+0000) Subject: Refactor use of basestring to use exec() on attempted assignment of X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=003453475b4fb0b0b9f9031ed6a10876fa4f7e71;p=scons.git Refactor use of basestring to use exec() on attempted assignment of 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 --- diff --git a/src/engine/SCons/compat/_scons_shlex.py b/src/engine/SCons/compat/_scons_shlex.py index 6ed39cfa..2a748ff4 100644 --- a/src/engine/SCons/compat/_scons_shlex.py +++ b/src/engine/SCons/compat/_scons_shlex.py @@ -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: