Skip to content

Fix IndexError on a blank setting value - #84

Open
hilman2 wants to merge 1 commit into
CheetahTemplate3:masterfrom
hilman2:fix-empty-setting-value
Open

Fix IndexError on a blank setting value#84
hilman2 wants to merge 1 commit into
CheetahTemplate3:masterfrom
hilman2:fix-empty-setting-value

Conversation

@hilman2

@hilman2 hilman2 commented Aug 26, 2026

Copy link
Copy Markdown
>>> SettingsManager().updateSettingsFromConfigStr('foo =')
IndexError: string index out of range

stringIsNumber reads S[0] after strip() without checking for the empty string. Every config value goes through it, including every value in a #compiler-settings block. An empty string is not a number, so it now returns False and the value is kept as ''.

Two tests in Tests/Misc.py. Full suite passes on 2.7, 3.6 and 3.12, flake8 clean.

stringIsNumber() reads S[0] after strip() without checking for the
empty string. Every config value goes through it, so a blank value in
a config file or a #compiler-settings block raised IndexError instead
of being kept as the empty string.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants