From d58dff5877e75c3c7813045a075e50b23ecb1dfd Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Thu, 15 Apr 2010 01:06:53 +0000 Subject: 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. --- src/engine/SCons/compat/_scons_shlex.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/engine/SCons/compat/_scons_shlex.py b/src/engine/SCons/compat/_scons_shlex.py index 6ed39cf..2a748ff 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: -- cgit v0.12