Kaydet (Commit) b11bd036 authored tarafından Andrew M. Kuchling's avatar Andrew M. Kuchling

Fix bugs with integer-valued variables when parsing Makefiles. Values

for done[n] can be integers as well as strings, but the code
concatenates them with strings (fixed by adding a str()) and calls
string.strip() on them (fixed by rearranging the logic)

(Presumably this wasn't noticed previously because parse_makefile()
was only called on Modules/Makefile, which contains no integer-valued
variables.)
üst 9710297e
......@@ -204,13 +204,15 @@ def parse_makefile(fn, g=None):
n = m.group(1)
if done.has_key(n):
after = value[m.end():]
value = value[:m.start()] + done[n] + after
value = value[:m.start()] + str(done[n]) + after
if "$" in after:
notdone[name] = value
else:
try: value = string.atoi(value)
except ValueError: pass
done[name] = string.strip(value)
except ValueError:
done[name] = string.strip(value)
else:
done[name] = value
del notdone[name]
elif notdone.has_key(n):
# get it on a subsequent round
......@@ -223,8 +225,10 @@ def parse_makefile(fn, g=None):
notdone[name] = value
else:
try: value = string.atoi(value)
except ValueError: pass
done[name] = string.strip(value)
except ValueError:
done[name] = string.strip(value)
else:
done[name] = value
del notdone[name]
else:
# bogus variable reference; just drop it since we can't deal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment