Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse hour with hyphen #1315

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dmj111
Copy link

@dmj111 dmj111 commented Oct 30, 2023

Summary of changes

Fix parsing to handle - at the end of fuzzy string .

The logic change looks at the length of the token list before accessing the next value to avoid reading past the end of the list.

Closes #256

Pull Request Checklist

  • Changes have tests
  • Authors have been added to AUTHORS.md
  • News fragment added in changelog.d. See CONTRIBUTING.md for details

Fuzzy parsing fails when the string ends with `-`.
The parsing logic assumed a + or - is followed by more data.  One of
those at the end of the string could cause an indexing error.

This change adds a check for the token list length before looking at
the next token.
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.

ValueError when trying to parse an hour string following a hyphen.
1 participant