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

Replace assert with raise AssertionError (fixes support for PYTHONOPTIMIZE=1) #644

Merged
merged 1 commit into from
Jun 22, 2023
Merged

Replace assert with raise AssertionError (fixes support for PYTHONOPTIMIZE=1) #644

merged 1 commit into from
Jun 22, 2023

Conversation

JonneDatanen
Copy link

Assert seems to behave badly in some cases and should not be used for
handling runtime errors.

See for example:
https://medium.com/@jadhavmanoj/python-what-is-raise-and-assert-statement-c3908697bc62
https://github.com/emre/notes/blob/master/python/when-to-use-assert.md

Copy link
Collaborator

@hartwork hartwork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @neliseiska,

I confirm that (1) without this pull request export PYTHONOPTIMIZE=1 makes the current code fail and (2) with this pull requests those failing tests turn green. Hence I will merge this pull request. Thanks for your contribution to VCR.py! 🙏

Best, Sebastian

@hartwork hartwork changed the title Replace assert with raise AssertionError Replace assert with raise AssertionError (fixes support for PYTHONOPTIMIZE=1) Jun 22, 2023
@hartwork hartwork merged commit 8b97fd6 into kevin1024:master Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants