Fix KeyError when models_package is not set - #1219
Merged
Merged
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 9390 9393 +3
Branches 1443 1444 +1
===========================================
+ Hits 9390 9391 +1
- Misses 0 1 +1
- Partials 0 1 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jootten
force-pushed
the
fix-binding-model-detection
branch
2 times, most recently
from
April 21, 2026 10:24
368ec04 to
44653fa
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.
tefra
force-pushed
the
fix-binding-model-detection
branch
from
July 10, 2026 04:20
44653fa to
fdd06b6
Compare
|
Contributor
Author
|
Are any further modifications required @tefra? |
tefra
approved these changes
Jul 18, 2026
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.