Skip to content

Comments

[BE] Enable C419 rule for any all shortcircuiting#99890

Closed
Skylion007 wants to merge 3 commits intopytorch:mainfrom
Skylion007:skylion007/ruff-enable-C419
Closed

[BE] Enable C419 rule for any all shortcircuiting#99890
Skylion007 wants to merge 3 commits intopytorch:mainfrom
Skylion007:skylion007/ruff-enable-C419

Conversation

@Skylion007
Copy link
Collaborator

@Skylion007 Skylion007 commented Apr 24, 2023

Apparently #78142 made torch.JIT allow for simple generator expressions which allows us to enable rules that replace unnecessary list comprehensions with generators in any/all. This was originally part of #99280 but I split it off into this PR so that it can be easily reverted should anything break.

cc @soumith @voznesenskym @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @desertfire

@pytorch-bot
Copy link

pytorch-bot bot commented Apr 24, 2023

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

As of commit ad98f63:
💚 Looks good so far! There are no failures yet. 💚

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

@pytorch-bot pytorch-bot bot added the release notes: releng release notes category label Apr 24, 2023
@Skylion007 Skylion007 added the ciflow/trunk Trigger trunk jobs on your pull request label Apr 24, 2023
@Skylion007 Skylion007 requested a review from justinchuby April 24, 2023 16:39
@Skylion007 Skylion007 force-pushed the skylion007/ruff-enable-C419 branch from 95bae8f to ad98f63 Compare April 24, 2023 19:12
@Skylion007 Skylion007 marked this pull request as ready for review April 25, 2023 00:18
@Skylion007
Copy link
Collaborator Author

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: Approval needed from one of the following:
davides, haichuan-fb, nickgg, smessmer, brad-mengchi, ...

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

Copy link
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.

We should keep at least one test in JIT that checks, that all (if at all supported by JitScript) can accept list

@Skylion007
Copy link
Collaborator Author

We should keep at least one test in JIT that checks, that all (if at all supported by JitScript) can accept list

Why? We have no special handling of any / all vs other builtins that already test list comprehensions. I could not find any unit tests for "any" / "all" specifically before this PR and none were changed. It should be fine as I don't think it should trigger any special behavior and no specific any/all tests were edited to my knowledge. @malfet was there a specific change to a unit test you wanted me to revert?

@malfet
Copy link
Contributor

malfet commented Apr 25, 2023

Why? We have no special handling of any / all vs other builtins that already test list comprehensions. I could not find any unit tests for "any" / "all" specifically before this PR and none were changed. It should be fine as I don't think it should trigger any special behavior and no specific any/all tests were edited to my knowledge. @malfet was there a specific change to a unit test you wanted me to revert?

If there are no specific handling, than it's probably fine as is. But haven't you mentioned that certain PR added list comprehension support to JITScript. If this is the case, it would be good to have at least one test that constructs a list inside the jited function and passes it to one of builtins.

But I've scanned your change yesterday and couldn't spot a single test that you've modified that tested for this functionality.
So please go ahead and merge.

@malfet
Copy link
Contributor

malfet commented Apr 25, 2023

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

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

@Skylion007 Skylion007 deleted the skylion007/ruff-enable-C419 branch April 25, 2023 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants