Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-128509: Addsys._is_immortal for identifying immortal objects#128510

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
kumaraditya303 merged 20 commits intopython:mainfromZeroIntensity:is-immortal-sys
Jan 31, 2025

Conversation

@ZeroIntensity
Copy link
Member

@ZeroIntensityZeroIntensity commentedJan 5, 2025
edited
Loading

eendebakpt, dg-pb, and bswck reacted with thumbs up emoji
@ZeroIntensity
Copy link
MemberAuthor

@vstinner I think this is ready now that#129182 is merged. Could you take a look when you get a chance?

# CRASHES _testcapi.is_immortal(NULL)

deftest_sys(self):
self.immortal_checking(sys._is_immortal)
Copy link
Member

Choose a reason for hiding this comment

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

sys functions must be checked in test_sys.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I intentionally moved the test fromtest_sys totest_immortal so we could re-use the test case, but I've reverted it now. Are you ok with the redundancy?

Copy link
Member

Choose a reason for hiding this comment

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

I'm ok with redundancy. test_capi can be skipped if _testcapi is missing. It's not the case for test_sys. Both tests are useful.

ZeroIntensity reacted with thumbs up emoji
sys__is_immortal_impl(PyObject*module,PyObject*op)
/*[clinic end generated code: output=c2f5d6a80efb8d1a input=83733fc356c78475]*/
{
return_Py_IsImmortal(op);
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 using PyUnstable_IsImmortal()?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

The two are pretty similar. Would you prefer I use the unstable API?

Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to use the public unstable API, yes.

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

LGTM. IMO it makes sense to have a way in Python to check if an object is immortal. Otherwise, developers are confused by surprisingsys.getrefcount() values.

}
}


Copy link
Member

Choose a reason for hiding this comment

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

unrelated change, I suggest to leave this empty line :-)

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Good catch!

@vstinner
Copy link
Member

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
@kumaraditya303kumaraditya303enabled auto-merge (squash)January 31, 2025 15:04
@kumaraditya303kumaraditya303 merged commit9ba281d intopython:mainJan 31, 2025
42 checks passed
@ZeroIntensityZeroIntensity deleted the is-immortal-sys branchJanuary 31, 2025 16:16
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull requestFeb 7, 2025
…cts (python#128510)Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@vstinnervstinnervstinner approved these changes

@kumaraditya303kumaraditya303kumaraditya303 approved these changes

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrentlyericsnowcurrently is a code owner

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@ZeroIntensity@vstinner@kumaraditya303

[8]ページ先頭

©2009-2025 Movatter.jp