-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
gh-139716: StackRef tests are added #139717
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I've one concern about code organization, but that's all.
Modules/_testinternalcapi.c
Outdated
| } | ||
|
|
||
| static PyObject * | ||
| stackref_to_tuple(_PyStackRef ref, PyObject *op) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worry that stackref_to_tuple is likely to get out of sync when the stackref implementation changes. Can you move it to Python/stackrefs.c, rename it to _PyStackRef_AsTuple and a declaration to pycore_stackref.h
The other functions below are fine here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done this change. But I can see no much value in moving this function to Python/stackrefs.c, so I create 3 different implementations of this little function at pycore_stackref.h.
|
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. |
|
Thanks for making the requested changes! @markshannon: please review the changes made to this pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
New test file
Lib/test/test_stackrefs.pyintroduced.Some auxillary functions are added to
_testinternalcapi.Those functions are examples of correct
StackRefscenarios.We check that all
refcountsremain correct.And that results are the same for equivalent scenarios.
PyStackReffunctions #139716