fix: handle unsupported architectures gracefully in setup_env.py#478
Open
aayushbaluni wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: handle unsupported architectures gracefully in setup_env.py#478aayushbaluni wants to merge 1 commit intomicrosoft:mainfrom
aayushbaluni wants to merge 1 commit intomicrosoft:mainfrom
Conversation
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.
Summary
Fixes three error-handling bugs in
setup_env.pythat cause crashes or misleading exit codes on unsupported platforms.Bug 1 —
exit(0)on error condition (line 212):compile()callsexit(0)when the architecture is unsupported, reporting success instead of failure.Bug 2 —
ARCH_ALIASKeyError on unrecognized platforms (line 85):system_info()uses a dict lookupARCH_ALIAS[platform.machine()]which raisesKeyErrorfor architectures not in the alias table (e.g.i686,riscv64,ppc64le). This crashes before the architecture check incompile()can provide a proper error message.Bug 3 —
parse_args()KeyError on unsupported arch (line 225):parse_args()usesSUPPORTED_QUANT_TYPES[arch]for argparsechoices, which also raisesKeyErrorfor unknown architectures.Changes
setup_env.py:85: ChangedARCH_ALIAS[platform.machine()]toARCH_ALIAS.get(platform.machine(), platform.machine())— unknown architectures now pass through instead of crashing.setup_env.py:212: Changedexit(0)tosys.exit(1)— error condition now reports failure correctly.setup_env.py:225-228: Added early arch check inparse_args()with a clear error message before argparse tries to use the unsupported arch.Testing
AMD64,x86_64,aarch64,arm64,ARM64) behave identically to beforeKeyErrortracebackMade with Cursor