-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
topic: reportingrelated to terminal output and user-facing messages and errorsrelated to terminal output and user-facing messages and errorstype: bugproblem that needs to be addressedproblem that needs to be addressed
Description
The test below reproduces the problem:
import weakref
class Obj:
pass
ref = None
def test1():
obj = Obj()
global ref
ref = weakref.ref(obj)
assert 0
def test2():
assert ref() is None
This fails with:
================================== FAILURES ===================================
____________________________________ test1 ____________________________________
def test1():
obj = Obj()
global ref
ref = weakref.ref(obj)
> assert 0
E assert 0
test_foo.py:15: AssertionError
____________________________________ test2 ____________________________________
def test2():
> assert ref() is None
E assert <test_foo.Obj object at 0x0000017302911198> is None
E + where <test_foo.Obj object at 0x0000017302911198> = ref()
test_foo.py:19: AssertionError
========================== 2 failed in 0.04 seconds ===========================
The reference to test1
's frame should not have leaked. If we comment the assert 0
line, then both tests pass.
xref: pytest-dev/pytest-qt#187
Metadata
Metadata
Assignees
Labels
topic: reportingrelated to terminal output and user-facing messages and errorsrelated to terminal output and user-facing messages and errorstype: bugproblem that needs to be addressedproblem that needs to be addressed