Skip to content

Conversation

BobTheBuidler
Copy link
Contributor

@BobTheBuidler BobTheBuidler commented Jun 3, 2025

This PR adds 2 new weakref primitives for weakref.proxy (1 and 2 arg)

The C code generates correctly, but I'm not entirely sure why this test is failing. The weakly-proxied object is being destroyed too early, while there should still be a strong reference to it. It also fails if we use the builtin weakref.proxy, so I believe this might be exposing a reference counting bug unrelated to this PR.

@BobTheBuidler

This comment was marked as resolved.

@BobTheBuidler
Copy link
Contributor Author

Tests are fixed, this PR is now ready for review.

@BobTheBuidler
Copy link
Contributor Author

Thanks for the feedbacks, I've addressed all of them and this PR is again ready for review.

@BobTheBuidler BobTheBuidler requested a review from JukkaL August 17, 2025 16:24
@BobTheBuidler
Copy link
Contributor Author

Hmm.. what happened here? the testutil import broke the tests?

@BobTheBuidler
Copy link
Contributor Author

@JukkaL any idea why replacing pytest.raises with assertRaises is giving us all of these type-related errors?

its another typeshed thing?

class list: ...
class BaseException: ...
class Exception(BaseException): ...
class ReferenceError(Exception): ...
Copy link
Collaborator

Choose a reason for hiding this comment

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

This fixture is probably causing the problems -- some of these definitions are too simplified (or missing). If ReferenceError is the only new thing you need here, what about adding it to the generic ir.py?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I saw a comment somewhere indicating not to add things to that file as it would slow down the whole suite.

No worries, I've updated the PR accordingly and the tests pass now.

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