Skip to content
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

gh-104635: Add a test case for variables that have a dependency. #106583

Merged
merged 3 commits into from Jul 11, 2023

Conversation

corona10
Copy link
Member

@corona10 corona10 commented Jul 10, 2023

@corona10
Copy link
Member Author

I found this case while I worked for #106571 (comment), It will be helpful to the future researcher.

@@ -1186,6 +1186,12 @@ def f(x, y, z):
return a
self.assertEqual(f("x", "y", "z"), "y")

def test_variable_dependent(self):
Copy link
Member

Choose a reason for hiding this comment

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

Can you please explain the purpose of the test in a comment? From the code, it's nonibvious to me how it can be miscompiled.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you please explain the purpose of the test in a comment? From the code, it's nonibvious to me how it can be miscompiled.

No, it doesn't miscompile at this optimization moment.
But I was quite surprised with the CI never failed with the wrong compile for the #106571 (comment).
So it could be good to be added. I thought that miscompile case should be caught at the CI level.

Copy link
Member

Choose a reason for hiding this comment

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

I don't say that the code is miscompiled. I propose adding a comment to explain that the test checks that this specific code is not miscompiled, but please explain why it could be miscompiled.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@corona10 corona10 requested a review from vstinner July 10, 2023 11:30
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM. I just suggest a minor phrasing change.

Lib/test/test_compile.py Outdated Show resolved Hide resolved
Co-authored-by: Carl Meyer <carl@oddbird.net>
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@corona10 corona10 merged commit 115df84 into python:main Jul 11, 2023
20 checks passed
@corona10 corona10 deleted the gh-104635-test-case branch July 11, 2023 01:15
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.

None yet

4 participants