Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

Bug: Avoid assert calls in production code #2385

Open
l0b0 opened this issue Nov 30, 2022 · 2 comments
Open

Bug: Avoid assert calls in production code #2385

l0b0 opened this issue Nov 30, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@l0b0
Copy link
Contributor

l0b0 commented Nov 30, 2022

Bug Description

Python removes assert calls when compiling optimised code, meaning that they don't actually do anything in production code. This will result in the code following different code paths in testing and production.

@l0b0 l0b0 added the bug Something isn't working label Nov 30, 2022
@Jimlinz
Copy link
Contributor

Jimlinz commented Nov 30, 2022

This makes sense. I've been told not to use assert outside of test, but never found a good explanation as to why. Does this mean none of the assert calls in the production is actually doing anything?

@l0b0
Copy link
Contributor Author

l0b0 commented Dec 1, 2022

Does this mean none of the assert calls in the production is actually doing anything?

Yep. Which could cause some really confusing bugs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants