Skip to content

Add raw throw lint#177046

Closed
albanD wants to merge 1 commit intopytorch:mainfrom
albanD:throw_lint
Closed

Add raw throw lint#177046
albanD wants to merge 1 commit intopytorch:mainfrom
albanD:throw_lint

Conversation

@albanD
Copy link
Copy Markdown
Collaborator

@albanD albanD commented Mar 10, 2026

Add pattern-based skip. Let me know if you prefer regular exclude list.

@albanD albanD requested a review from malfet March 10, 2026 18:00
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Mar 10, 2026

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit 139db2d with merge base b9d551d (image):

NEW FAILURE - The following job has failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot bot added the release notes: vulkan release notes category label Mar 10, 2026
Copy link
Copy Markdown
Contributor

@malfet malfet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, though I wonder if clang-tidy already have a rule for it (if not, may be we should propose one)

Do not use raw `throw` in C++ code. Use TORCH_CHECK, \
TORCH_CHECK_WITH, C10_THROW_ERROR, or other error-reporting macros \
instead. See c10/util/Exception.h for available macros. If this is a \
re-throw (throw;), restructure the code to avoid try/catch/throw or \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a suggestion - can we add C10_RETHROW macro, and somehow use clang-tidy to detect it's used correctly?

@albanD
Copy link
Copy Markdown
Collaborator Author

albanD commented Mar 10, 2026

@malfet this doesn't actually only forbid naked throw. It forbids any use of "throw ..." as well. So I don't expect there is a clang-tidy rule for it as it would prevent throwing exceptions :D

@albanD albanD added ciflow/trunk Trigger trunk jobs on your pull request topic: not user facing topic category labels Mar 10, 2026
@albanD
Copy link
Copy Markdown
Collaborator Author

albanD commented Mar 12, 2026

@pytorchbot merge -i

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged while ignoring the following 1 checks: pull / linux-jammy-py3.10-gcc11 / test (distributed, 2, 2, linux.2xlarge)

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

EmanueleCoradin pushed a commit to EmanueleCoradin/pytorch that referenced this pull request Mar 30, 2026
Add pattern-based skip. Let me know if you prefer regular exclude list.
Pull Request resolved: pytorch#177046
Approved by: https://github.com/malfet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged release notes: vulkan release notes category topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants