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

Appearance settings

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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
Loading
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(test): fix test ref
  • Loading branch information
BobTheBuidler committed May 23, 2025
commit 8d41c269b345c651d76a56f10bd213f648662e44
11 changes: 7 additions & 4 deletions 11 mypyc/test-data/run-weakref.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@ import asyncio
import pytest # type: ignore [import-not-found]
from weakref import ref

@mypyc_attr(native_class=False)
class Object:
"""some random weakreffable object"""
pass

def test_weakref_ref():
# some random weakreffable object
obj = asyncio.new_event_loop()
obj = Object()
r = ref(obj)
assert r() is obj
obj = None
assert r() is None, r()

def test_weakref_ref_with_callback():
# some random weakreffable object
obj = asyncio.new_event_loop()
obj = Object()
r = ref(obj, lambda x: x)
assert r() is obj
obj = None
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.