diff --git a/utils/gyb.py b/utils/gyb.py index e7bbf895035a8..3d5254c8d5419 100755 --- a/utils/gyb.py +++ b/utils/gyb.py @@ -15,6 +15,11 @@ from bisect import bisect +try: + basestring +except NameError: + basestring = str + def get_line_starts(s): """Return a list containing the start index of each line in s. @@ -716,7 +721,8 @@ def execute(self, context): # If we got a result, the code was an expression, so append # its value - if result is not None and result != '': + if result is not None \ + or (isinstance(result, basestring) and result != ''): from numbers import Number, Integral result_string = None if isinstance(result, Number) and not isinstance(result, Integral):