Skip to content

[mypyc] Fix incref/decref on free-threaded builds #19127

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

Merged
merged 1 commit into from
May 27, 2025

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented May 21, 2025

Fix C compile errors on free-threaded builds. We can't (easily) access the reference count value directly, so always use the C API functions when on a free-threaded build.

Work on mypyc/mypyc#1038.

Fix C compile errors on free-threaded builds. We can't (easily) access
the reference count value directly, so always use the C API functions
when on a free-threaded build.
@@ -31,6 +31,8 @@
// Here just for consistency
#define CPy_XDECREF(p) Py_XDECREF(p)

#ifndef Py_GIL_DISABLED

// The *_NO_IMM operations below perform refcount manipulation for
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you adjust this comment to mention something like "this optimization cannot be performed with free threaded mode so we fallback to just calling the normal decref.

@JukkaL JukkaL merged commit 750a579 into master May 27, 2025
12 checks passed
@JukkaL JukkaL deleted the free-thread-inc-dec-ref branch May 27, 2025 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants