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

Add PyUnstable_TryIncref and PyUnstable_EnableTryIncRef.#159

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
vstinner merged 4 commits intopython:mainfromcolesbury:try_incref
Nov 5, 2025

Conversation

@colesbury
Copy link
Contributor

These would be useful in PyTorch, which uses pythoncapi-compat.h. They are also already used inpybind11, which doesn't use pythoncapi-compat.h.

albanD reacted with thumbs up emoji
return-1;
}
#endif
MyType.tp_name="MyType";
Copy link
Member

Choose a reason for hiding this comment

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

Can you please use a less generic name, such asTryIncrefType? (for the variable name and the type name)

colesbury reacted with thumbs up emoji
@vstinner
Copy link
Member

I'm fine with adding these two functions. I just have some suggestions on the implementation.

colesbury reacted with thumbs up emoji

colesburyand others added2 commitsNovember 5, 2025 16:44
Co-authored-by: Victor Stinner <vstinner@python.org>
staticintMyObject_dealloc_called=0;

staticvoid
MyObject_dealloc(PyObject*op)
Copy link
Member

Choose a reason for hiding this comment

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

Would you mind to rename it toTryIncref_dealloc() and rename alsoMyObject_dealloc_called?

colesbury reacted with thumbs up emoji
@vstinnervstinner merged commitc44469c intopython:mainNov 5, 2025
36 checks passed
@vstinner
Copy link
Member

Merged, thanks for your contribution.

@colesburycolesbury deleted the try_incref branchNovember 5, 2025 22:08
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@vstinnervstinnervstinner left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@colesbury@vstinner

[8]ページ先頭

©2009-2025 Movatter.jp