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

Only raise assertions for source code #16215

Merged
merged 1 commit into from
Feb 28, 2024
Merged

Only raise assertions for source code #16215

merged 1 commit into from
Feb 28, 2024

Conversation

seanbudd
Copy link
Member

@seanbudd seanbudd commented Feb 23, 2024

Link to issue number:

Fix up of #15544

Summary of the issue:

#15544 changed our compiler flag to raise exceptions if an assert statement fails.
This slows down NVDA (having to check exceptions) and adds risk to final releases.
This lead to #16212 being discovered

Description of user facing changes

Assertions should be ignored in builds

Description of development approach

Restored optimize level to 1
https://docs.python.org/3.11/tutorial/modules.html#compiled-python-files

Testing strategy:

Known issues with pull request:

#16212 is still an issue that needs to be fixed

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@seanbudd seanbudd requested a review from a team as a code owner February 23, 2024 01:56
@seanbudd seanbudd requested review from michaelDCurran and removed request for a team February 23, 2024 01:56
@seanbudd seanbudd added this to the 2024.1 milestone Feb 23, 2024
@AppVeyorBot
Copy link

See test results for failed build of commit 8737fb3a36

source/setup.py Outdated Show resolved Hide resolved
Copy link
Member

@michaelDCurran michaelDCurran left a comment

Choose a reason for hiding this comment

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

Agreed with @lukaszgo1 that this logic differs from what we used to have and that we can no longer make try-release builds.
Note that try-release builds are marked as release but also as a test version.
But there is a contradiction between setup.py and SConstruct in that if we are building a release, python setup.py will be run with -O (optimise=1) but if this is a test version, setup.py itself tells the compiled NVDA to be run with optimise=0. Thus try-release builds will end up with optimise=0.
release should be passed into setup.py, and optimise should be 1 if release is true.
I acknowledge that this then means we will again treat betas as release, and therefore assertions won't be on in betas. But, personally, I do think that assertions should really only be for alphas (bleeding-edge code). Betas although prerelease, should still function as releases in terms of performance.

@seanbudd seanbudd changed the title Only raise assertions for test code Only raise assertions for source code Feb 28, 2024
@seanbudd seanbudd merged commit c8b2dcf into beta Feb 28, 2024
3 checks passed
@seanbudd seanbudd deleted the fix-asserts branch February 28, 2024 03:01
Adriani90 pushed a commit to Adriani90/nvda that referenced this pull request Mar 13, 2024
Fix up of nvaccess#15544

Summary of the issue:
nvaccess#15544 changed our compiler flag to raise exceptions if an assert statement fails.
This slows down NVDA (having to check exceptions) and adds risk to final releases.
This lead to nvaccess#16212 being discovered

Description of user facing changes
Assertions should be ignored in builds

Description of development approach
Restored optimize level to 1
https://docs.python.org/3.11/tutorial/modules.html#compiled-python-files
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.

4 participants