Skip to content

Conversation

@jbrockmendel
Copy link
Contributor

If that branch was reached, asserting mstridx == -1 immediately after setting mstridx = len(ymd)-1 should always fail (ymd is not empty at this point). I'll circle back to add a test case to cover this.

If that branch was reached, asserting `mstridx == -1` immediately after setting `mstridx = len(ymd)-1` should always fail (`ymd` is not empty at this point).  I'll circle back to add a test case to cover this.
@pganssle
Copy link
Member

pganssle commented Jul 4, 2017

This is a bit bizarre. I think maybe we should figure out if it's even possible for that assertion to be incorrect and maybe raise a more appropriate message than AssertionError.

@jbrockmendel Did you run into this in the wild, or discover it when reading the code?

@jbrockmendel
Copy link
Contributor Author

Reading the code. I spent some time refactoring common patterns to try to cut down the big while loop in parse.

If I disable the error-catching, I can trigger this assertion with "2016-15-May". It looks like it only gets reached when the month is at the end, so it makes sense that it would be rare.

jbrockmendel added a commit to jbrockmendel/dateutil that referenced this pull request Jul 4, 2017
@jbrockmendel
Copy link
Contributor Author

This PR was made with GH's editor as a quick-fix. Replacing it with a fully-fledged PR #409.

@jbrockmendel jbrockmendel deleted the patch-1 branch July 4, 2017 18:06
justanr pushed a commit to justanr/dateutil that referenced this pull request Jul 29, 2017
@pganssle pganssle added this to the wontfix milestone Mar 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants