Skip to content

Fix parsing of deprecated list options failing with empty strings#430

Merged
minrk merged 2 commits intoipython:masterfrom
ankostis:fix_emptystr_listopopts
Aug 8, 2017
Merged

Fix parsing of deprecated list options failing with empty strings#430
minrk merged 2 commits intoipython:masterfrom
ankostis:fix_emptystr_listopopts

Conversation

@ankostis
Copy link
Copy Markdown
Contributor

@ankostis ankostis commented Jul 22, 2017

When a list trait is aliased, and a single empty-string is given in command-line, like this:

foo -=seq-option=""

The traitlets.config.loader fails when attempting to parse it as [deprecated, list, format], with this error:

  File "/home/user/traitlets/config/application.py", line 702, in parse_command_line
    self.cli_config = deepcopy(loader.load_config())
  File "/home/user/traitlets/config/loader.py", line 804, in load_config
    self._convert_to_config()
  File "/home/user/traitlets/config/loader.py", line 947, in _convert_to_config
    self._exec_config_str(k, v, trait=trait)
  File "/home/user/traitlets/config/loader.py", line 542, in _exec_config_str
    (r[0] == '[' and r[-1] == ']') or
IndexError: string index out of range
  • The fix consists of skipping deprecated-list parsing on zero-length strings.
  • A TC is included proving the problem is fixed.

@ankostis ankostis force-pushed the fix_emptystr_listopopts branch from 3a9be76 to 23f09f8 Compare July 22, 2017 21:18
@minrk minrk merged commit a49d6c7 into ipython:master Aug 8, 2017
@Carreau Carreau added this to the 5.0 milestone Jun 4, 2020
@Carreau Carreau added 5.0-re-review Need to re-review for potential API impact changes. 5.0-minor rereviewed, minor change need to be put in changelog. and removed 5.0-re-review Need to re-review for potential API impact changes. labels Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5.0-minor rereviewed, minor change need to be put in changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants