Skip to content

fix: replace bare except with except Exception in pytree init#18744

Open
harshadkhetpal wants to merge 1 commit intopytorch:mainfrom
harshadkhetpal:fix/bare-except-pytree-init
Open

fix: replace bare except with except Exception in pytree init#18744
harshadkhetpal wants to merge 1 commit intopytorch:mainfrom
harshadkhetpal:fix/bare-except-pytree-init

Conversation

@harshadkhetpal
Copy link
Copy Markdown

Summary

Replace bare except: with except Exception: in extension/pytree/__init__.py.

Bare except: catches all exceptions including SystemExit, KeyboardInterrupt, and GeneratorExit, which should not be silently caught. Since this handler only logs and falls back to torch pytree on import failure, catching Exception is the correct scope.

Change:

# Before
except:
    logger.info(...)

# After
except Exception:
    logger.info(...)

Testing

No behavior change — the import fallback logic is preserved.

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Apr 7, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18744

Note: Links to docs will display an error until the docs builds have been completed.

❌ 4 New Failures, 2 Unrelated Failures

As of commit 8c1f79c with merge base b9a6b84 (image):

NEW FAILURES - The following jobs have 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.

@meta-cla
Copy link
Copy Markdown

meta-cla bot commented Apr 7, 2026

Hi @harshadkhetpal!

Thank you for your pull request and welcome to our community.

Action Required

In 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.

Process

In 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 CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@nil-is-all nil-is-all added the module: extension Issues related to code under extension/ label Apr 7, 2026
@nil-is-all
Copy link
Copy Markdown
Contributor

Hi @harshadkhetpal, please sign the CLA and clear the failing checks (also in #18484)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: extension Issues related to code under extension/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants