fix: replace bare except with except Exception (3 files)#18484
fix: replace bare except with except Exception (3 files)#18484harshadkhetpal wants to merge 3 commits intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18484
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 Awaiting Approval, 1 New Failure, 3 Unrelated FailuresAs of commit 09a9209 with merge base b9a6b84 ( NEW FAILURE - The following job has failed:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Hi @harshadkhetpal! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
This PR needs a
|
|
Hi @harshadkhetpal, do resolve the errors logged by the lintrunner and let us know. |
Summary
Replace bare
except:clauses withexcept Exception:across 3 files to improve error handling specificity.Bare
except:catches all exceptions includingSystemExit,KeyboardInterrupt, andGeneratorExit, which should typically propagate. Since none of these sites re-raise,except Exception:is the correct replacement (PEP 8, B001).Changes:
extension/pytree/__init__.py:examples/models/mobilenet_v2/model.py:examples/models/llama/install_requirement_helper.py(2 occurrences):Testing
No behavior change — style/correctness fix only. All sites are import fallbacks or error-swallowing patterns where
Exceptionis the appropriate base class.cc @mergennachin @iseeyuan @lucylq @helunwencser @tarun292 @kimishpatel @jackzhxng @larryliu0820 @cccclai