FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-139716: StackRef tests are added by efimov-mikhail · Pull Request #139717 · python/cpython · GitHub

/ cpython Public

gh-139716: StackRef tests are added - #139717

Open
efimov-mikhail wants to merge 32 commits into
python:mainfrom
efimov-mikhail:stackref_tests
Open

gh-139716: StackRef tests are added#139717
efimov-mikhail wants to merge 32 commits into
python:mainfrom
efimov-mikhail:stackref_tests

Conversation

efimov-mikhail commented Oct 7, 2025
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

New test file Lib/test/test_stackrefs.py introduced.
Some auxillary functions are added to _testinternalcapi.
Those functions are examples of correct StackRef scenarios.
We check that all refcounts remain correct.
And that results are the same for equivalent scenarios.

Copy link
Copy Markdown
Member Author

markshannon 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks good. I've one concern about code organization, but that's all.

Comment thread Modules/_testinternalcapi.c Outdated

bedevere-app Bot commented Oct 27, 2025

Copy link
Copy Markdown

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.

Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again.

bedevere-app Bot commented Oct 27, 2025

Copy link
Copy Markdown

Thanks for making the requested changes!

@markshannon: please review the changes made to this pull request.

bedevere-app Bot requested a review from markshannon October 27, 2025 16:24
efimov-mikhail marked this pull request as draft October 27, 2025 19:05
efimov-mikhail marked this pull request as ready for review October 27, 2025 19:05

Copy link
Copy Markdown
Member Author

Friendly ping, @markshannon @Fidget-Spinner .
Maybe I should make another change to this PR?

Fidget-Spinner 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Just two questions

Comment thread Include/internal/pycore_stackref.h Outdated
Comment thread Lib/test/test_stackrefs.py Outdated
Comment thread Include/internal/pycore_stackref.h Outdated
_PyStackRef_AsTuple(_PyStackRef ref, PyObject *op)
{
// Do not check StackRef flags in the free threading build.
return Py_BuildValue("(ni)", Py_REFCNT(op), -1);

efimov-mikhail Nov 17, 2025
edited
Loading

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Actually, I've realized that we could remove this special case.
It's related only to stackrefs for immortal objects at ft build.

We can make a little change for _PyStackRef_FromPyObjectSteal and for PyStackRef_FromPyObjectNew function: add Py_TAG_DEFERRED flag to references on immortal objects.
All tests passed with this change on my machine.
But I suggest doing this in the next small PR, and keep only tests changes here.

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I've created a #141675 for this change.

Comment thread Modules/_testinternalcapi.c Outdated
Comment thread Lib/test/test_stackrefs.py Outdated
Comment thread Modules/_testinternalcapi.c Outdated
Comment thread Modules/_testinternalcapi.c Outdated

sergey-miryanov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks!

Copy link
Copy Markdown
Member Author

CC @markshannon @Fidget-Spinner @colesbury
Could we merge this?

Another option is merge #143024 first and adapt tests for that change here.

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review skip news stale Stale PR or inactive for long period of time. tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL