Skip to content

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

Merged
corona10 merged 3 commits into
python:mainfrom
corona10:gh-104635-test-case
Jul 11, 2023
Merged

corona10 merged 3 commits into
python:mainfrom
corona10:gh-104635-test-case

Conversation

@corona10

@corona10 corona10 commented Jul 10, 2023 •

Copy link
Copy Markdown
Member
@corona10
corona10 requested a review from carljm July 10, 2023 05:09
@bedevere-bot bedevere-bot added the tests Tests in the Lib/test dir label Jul 10, 2023
@corona10 corona10 added skip news and removed tests Tests in the Lib/test dir awaiting core review labels Jul 10, 2023
@corona10

Copy link
Copy Markdown
Member Author

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

Comment thread Lib/test/test_compile.py
return a
self.assertEqual(f("x", "y", "z"), "y")

def test_variable_dependent(self):

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

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

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.

Comment thread Lib/test/test_compile.py Resolved
Co-authored-by: Carl Meyer <carl@oddbird.net>

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

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
@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

4 participants