Skip to content

WIP: new mypyc primitive for weakref.ref.__call__ #19145

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

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

BobTheBuidler
Copy link
Contributor

@BobTheBuidler BobTheBuidler commented May 23, 2025

This PR is a follow-up to #19099, adding a new rprimitive type for weakref.ReferenceType and another new custom_op primitive for weakref.ReferenceType.__call__ to dereference reference objects.

@BobTheBuidler BobTheBuidler changed the title Weakref call WIP: new mypyc primitive for weakref.ref.__call__ Jun 2, 2025
ilevkivskyi pushed a commit that referenced this pull request Jul 31, 2025
This PR adds a new mypyc primitive for `weakref.ref`

I wasn't able to figure out what name mypyc expects for `weakref.proxy`,
so I took that out and will keep that for a separate PR later on. ref is
more commonly used than proxy anyway.

for later, I tried:
- weakref.proxy
- weakref.ProxyType
- weakref.weakproxy

no luck with those

also for later, I'll need to finish #19145 to add a primitive for
`weakref.ref.__call__`
@@ -1098,3 +1098,18 @@ void CPy_SetImmortal(PyObject *obj) {
}

#endif


PyObject *CPyWeakref_GetRef(PyObject *ref)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need a new C function because of the variability of PyWeakref_GetRef

@BobTheBuidler BobTheBuidler marked this pull request as ready for review August 2, 2025 20:30
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.

1 participant