Fix KeyError when models_package is not set#1219
Open
jootten wants to merge 1 commit into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1219 +/- ##
===========================================
- Coverage 100.00% 99.97% -0.03%
===========================================
Files 116 116
Lines 9376 9379 +3
Branches 1439 1440 +1
===========================================
+ Hits 9376 9377 +1
- Misses 0 1 +1
- Partials 0 1 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
75d02b2 to
368ec04
Compare
tefra#1144 added a sys.modules check to avoid KeyError, but it was only reached when models_package was configured. Without it, the original KeyError still came back. Move the check out so it runs in both cases.
368ec04 to
44653fa
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



📒 Description
Follow-up to #1144. That PR added an
and clazz.__module__ in sys.modulesguard toXmlContext.is_binding_modelto prevent aKeyError, but placed it inside the branch that only runs whenmodels_packageis set. When nomodels_packageis configured,is_binding_modelshort-circuits onnot self.models_packageand the guard is skipped.I've encountered this bug for example with
amd.HIPOptionsfromtriton.This PR restructures the predicate so the
sys.modulesguard applies in both cases.