Skip to content

gh-131798: JIT: Narrow the return type of _GET_LEN to int #133345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

Zheaoli
Copy link
Contributor

@Zheaoli Zheaoli commented May 3, 2025

@bedevere-app
Copy link

bedevere-app bot commented May 6, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Zheaoli added 5 commits May 8, 2025 15:03
Signed-off-by: Manjusaka <[email protected]>
Signed-off-by: Manjusaka <[email protected]>
Signed-off-by: Manjusaka <[email protected]>
Signed-off-by: Manjusaka <[email protected]>
@Zheaoli Zheaoli force-pushed the manjusaka/get-len branch from ad1f5df to 52ce698 Compare May 8, 2025 07:07
Signed-off-by: Manjusaka <[email protected]>
@Zheaoli
Copy link
Contributor Author

Zheaoli commented May 8, 2025

I have made the requested changes; please review again.

@bedevere-app
Copy link

bedevere-app bot commented May 8, 2025

Thanks for making the requested changes!

@Fidget-Spinner, @brandtbucher: please review the changes made to this pull request.

@Zheaoli
Copy link
Contributor Author

Zheaoli commented May 8, 2025

BTW @brandtbucher @Fidget-Spinner sorry about the force push. I set pull with rebase as default on my environment. I will modify it in next PR(

@bedevere-app
Copy link

bedevere-app bot commented May 8, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Signed-off-by: Manjusaka <[email protected]>
@Zheaoli
Copy link
Contributor Author

Zheaoli commented May 9, 2025

I have made the requested changes; please review again

@bedevere-app
Copy link

bedevere-app bot commented May 9, 2025

Thanks for making the requested changes!

@brandtbucher, @Fidget-Spinner: please review the changes made to this pull request.

@bedevere-app bedevere-app bot requested a review from brandtbucher May 9, 2025 07:51
Signed-off-by: Manjusaka <[email protected]>
@Zheaoli Zheaoli requested a review from tomasr8 May 10, 2025 03:32
@@ -1925,6 +1925,34 @@ def testfunc(n):
self.assertNotIn("_GUARD_NOS_INT", uops)
self.assertNotIn("_GUARD_TOS_INT", uops)

def test_get_len(self):
Copy link
Member

Choose a reason for hiding this comment

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

You are missing the test case that Brandt suggested: #133345 (comment)

You could also split test_get_len into two separate test cases - other test cases typically only have one testfunc :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we need two case here

  1. match tuple, the GET_LEN will return a const
  2. match non-tuple, the GET_LEN will return a non-const lang

I have split this into two test case. Plz correct me if I'm wrong. PTAL when you get time

Copy link
Member

Choose a reason for hiding this comment

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

If I understood correctly, Brandt was suggesting a test case with a non-constant tuple. That is, a tuple with non-constant values, which is different from a non-tuple. So for example (object(), object()) (non-constant tuple) rather than [1, 2] (non-tuple) 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I understood correctly, Brandt was suggesting a test case with a non-constant tuple.

Yes, this is the original version of my thought. But I find that the code we add the the _GET_LEN will effect between tuple and non tuple. So I modify the test

But, your idea is making sense. Let me add test for non-constant tuple

Copy link
Member

Choose a reason for hiding this comment

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

More tests doesn't hurt! :)

Zheaoli added 3 commits May 10, 2025 22:24
Signed-off-by: Manjusaka <[email protected]>
Signed-off-by: Manjusaka <[email protected]>
Signed-off-by: Manjusaka <[email protected]>
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.

5 participants