Skip to content

Conversation

@sweeneyde
Copy link
Member

This test is deterministic, faster, and directly tests the behavior it's supposed to be testing, rather than relying on some C-level assertion to fail.

I checked that commenting out deopt_code(...) in _PyStaticCode_Dealloc causes the test to fail reliably.

cc @vstinner @markshannon

@bedevere-bot bedevere-bot added tests Tests in the Lib/test dir awaiting core review labels May 8, 2022
_handle_fromlist(dis, [name], lambda *args: None)
from dis import _all_opmap
resume = _all_opmap["RESUME"]
resume_quick = _all_opmap["RESUME_QUICK"]
Copy link
Member

Choose a reason for hiding this comment

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

Why not putting this code inside the code string?

Copy link
Member Author

Choose a reason for hiding this comment

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

Since this is testing parts of importlib, I'd like to use as little import machinery as possible, so there's no chance that imports prematurely specialize the _handle_fromlist.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a comment to explain it, since it's not obvious the first time that I read the code: the code starts with "Assert initially unquickened".

@vstinner vstinner merged commit 27185f9 into python:main May 11, 2022
@miss-islington
Copy link
Contributor

Thanks @sweeneyde for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 11, 2022
@vstinner
Copy link
Member

Merged, thanks!

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label May 11, 2022
@bedevere-bot
Copy link

GH-92699 is a backport of this pull request to the 3.11 branch.

miss-islington added a commit that referenced this pull request May 11, 2022
@sweeneyde sweeneyde deleted the better_test branch June 12, 2022 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants