Skip to content

Commit 82b5b9f

Browse files
committed
Fix the test for the new reference counting.
1 parent 3127a3f commit 82b5b9f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Modules/_testcapimodule.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2555,17 +2555,18 @@ test_interp_refcount(PyObject *self, PyObject *unused)
25552555
PyInterpreterState *interp = PyThreadState_GetInterpreter(tstate);
25562556
assert(interp != NULL);
25572557

2558-
assert(_PyInterpreterState_Refcount(interp) == 1);
2558+
assert(_PyInterpreterState_Refcount(interp) == 0);
25592559
PyInterpreterState *held = PyInterpreterState_Hold();
2560-
assert(_PyInterpreterState_Refcount(interp) == 2);
2561-
PyInterpreterState_Release(held);
25622560
assert(_PyInterpreterState_Refcount(interp) == 1);
2561+
PyInterpreterState_Release(held);
2562+
assert(_PyInterpreterState_Refcount(interp) == 0);
25632563

25642564
held = PyInterpreterState_Hold();
25652565
Py_EndInterpreter(tstate);
25662566
PyThreadState_Swap(save);
25672567
assert(_PyInterpreterState_Refcount(interp) == 1);
25682568
PyInterpreterState_Release(held);
2569+
assert(_PyInterpreterState_Refcount(interp) == 0);
25692570

25702571
Py_RETURN_NONE;
25712572
}

0 commit comments

Comments
 (0)