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

Fix custom repr for ParserError #993

Merged
merged 1 commit into from Jan 2, 2020

Conversation

pganssle
Copy link
Member

@pganssle pganssle commented Jan 2, 2020

Summary of changes

This was originally dead code, because an indentation error had __repr__ defined after the return statement in __str__. The definition of the __repr__ is also changed to be more in line with the conception of a repr as "what you would have to evalue to get this object".

Even though this is not guaranteed behavior, this commit also adds a regression test to avoid simple errors like this in the future.

Closes #991

Pull Request Checklist

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

@pganssle pganssle added this to the Bugfix release milestone Jan 2, 2020
@jbrockmendel
Copy link
Contributor

LGTM

@pganssle
Copy link
Member Author

pganssle commented Jan 2, 2020

Thanks for the review @jbrockmendel!

This was originally dead code, because an indentation error had `__repr__`
defined after the `return` statement in `__str__`. The definition of the
`__repr__` is also changed to be more in line with the conception of a
repr as "what you would have to evalue to get this object".

Even though this is not guaranteed behavior, this commit also adds a
regression test to avoid simple errors like this in the future.
@pganssle pganssle merged commit 110a09b into dateutil:master Jan 2, 2020
@pganssle pganssle modified the milestones: Bugfix release, 2.8.2 Jan 2, 2020
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.

ParserError custom __repr__ is not reached
2 participants