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: Remove use of asserts for control flow. #3359

Merged
merged 2 commits into from
Apr 9, 2024

Conversation

peterschutt
Copy link
Contributor

#3347 introduced a new pattern to differentiate between Pydantic v1 and v2 installs, however it relies on using assert which is an issue as can optimised away.

This PR changes the approach to manually throw an ImportError instead.

Closes #3354

Description

Closes

#3347 introduced a new pattern to differentiate between Pydantic v1 and v2 installs, however it relies on using `assert` which is an issue as can optimised away.

This PR changes the approach to manually throw an `ImportError` instead.

Closes #3354
@cofin cofin enabled auto-merge (squash) April 9, 2024 20:39
Copy link

sonarcloud bot commented Apr 9, 2024

Copy link

codecov bot commented Apr 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.28%. Comparing base (7bc6c34) to head (0a42d1a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3359      +/-   ##
==========================================
- Coverage   98.28%   98.28%   -0.01%     
==========================================
  Files         323      323              
  Lines       14780    14773       -7     
  Branches     2342     2345       +3     
==========================================
- Hits        14526    14519       -7     
  Misses        116      116              
  Partials      138      138              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cofin cofin merged commit 4495c65 into main Apr 9, 2024
27 checks passed
@cofin cofin deleted the remove-asserts-for-control-flow branch April 9, 2024 20:59
Copy link

github-actions bot commented Apr 9, 2024

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3359

peterschutt added a commit that referenced this pull request Apr 11, 2024
#3347 introduced a new pattern to differentiate between Pydantic v1 and v2 installs, however it relies on using `assert` which is an issue as can optimised away.

This PR changes the approach to manually throw an `ImportError` instead.

Closes #3354

(cherry picked from commit 4495c65)
peterschutt added a commit that referenced this pull request Apr 11, 2024
#3347 introduced a new pattern to differentiate between Pydantic v1 and v2 installs, however it relies on using `assert` which is an issue as can optimised away.

This PR changes the approach to manually throw an `ImportError` instead.

Closes #3354

(cherry picked from commit 4495c65)
peterschutt added a commit that referenced this pull request May 1, 2024
#3347 introduced a new pattern to differentiate between Pydantic v1 and v2 installs, however it relies on using `assert` which is an issue as can optimised away.

This PR changes the approach to manually throw an `ImportError` instead.

Closes #3354

(cherry picked from commit 4495c65)
peterschutt added a commit that referenced this pull request May 2, 2024
#3347 introduced a new pattern to differentiate between Pydantic v1 and v2 installs, however it relies on using `assert` which is an issue as can optimised away.

This PR changes the approach to manually throw an `ImportError` instead.

Closes #3354

(cherry picked from commit 4495c65)
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.

Bug: Remove use of assert for pydantic import flow control
2 participants