How to test code that uses weakrefs

Dima Tisnek <[email protected]> Mon, 2 Sep 2024 16:43:56 +0900
Newsgroups gmane.comp.python.pypy
Message-ID <CAGGBzXL93yJ8wh9euqZFwNGqyCGS1qXru_vrC+XOMb5aE5rOAg@mail.gmail.com>
--===============7858081853478091902==
Content-Type: multipart/alternative; boundary="00000000000058262706211e1b9e"

--00000000000058262706211e1b9e
Content-Type: text/plain; charset="UTF-8"

We've got a library that supports py 3.8 .. 3.12
I though I'd give it a go with newest pypy release, and a couple of unit
tests fail.
I've traced it down to the expectation that objects will disappear from
weakref.WeakKeyDictionary.

In some cases, this is a user-facing thing, we issue a warning for "unused"
resources, by virtue of them missing from the weak container when we expect
the user code to keep the reference around.

Is there a good idiom or some way to support this behaviour with pypy?

Thanks,
Dima Tisnek

--00000000000058262706211e1b9e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">We&#39;ve got a library that supports py 3.8 .. 3.12<div>I=
 though I&#39;d give it a go with newest pypy release, and a couple of unit=
 tests fail.</div><div>I&#39;ve traced it down to the expectation that obje=
cts will disappear from weakref.WeakKeyDictionary.</div><div><br></div><div=
>In some cases, this is a user-facing thing, we issue a warning for &quot;u=
nused&quot; resources, by virtue of them missing from the weak container wh=
en we expect the user code to keep the reference around.</div><div><br></di=
v><div>Is there a good idiom or some way to support this behaviour with pyp=
y?</div><div><br></div><div>Thanks,</div><div>Dima Tisnek=C2=A0</div></div>

--00000000000058262706211e1b9e--

--===============7858081853478091902==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
pypy-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/pypy-dev.python.org/
Member address: [email protected]

--===============7858081853478091902==--