GeezerVison is showing github.com — gh-115177: Clarify impact of -O and optimization in assert statement documentation by NXPY123 · Pull Request #119305 · python/cpython
Conversation
NXPY123
commented
May 21, 2024
•
edited by github-actions
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
The current simple_stmts.html#the-assert-statement text mentions -O as a tiny hyperlink over to #cmdoption-O but doesn't mention the PYTHONOPTIMIZE environment variable. This commit adds a hyperlink to it and adds a note warning of breaking logic when using assert statements in code. Fixes #115177
📚 Documentation preview 📚: https://cpython-previews--119305.org.readthedocs.build/
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
… asserts in assert statement documentation
* The current simple_stmts.html#the-assert-statement text mentions -O as a tiny hyperlink over to #cmdoption-O but doesn't mention the PYTHONOPTIMIZE environment variable. This commit adds a hyperlink to it.
…ssues with code containng assert statements when optimization is enabled
Added a remainder that logic could break when optimization is enabled when using assert statements in code. Mentioned that it's considered best practice to not use assert statements to evaluate function variables.
ghost
commented
May 21, 2024
•
edited by ghost
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
All commit authors signed the Contributor License Agreement. 
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
The following commit authors need to sign the Contributor License Agreement:

|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Closing as stale, the CLA is unsigned and there are conflicts.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
1 more reviewer
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.