Skip to content

Commit 9d8d526

Browse files
committed
Fix test from earlier semantics.
1 parent bc60630 commit 9d8d526

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

Modules/_testcapimodule.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2549,21 +2549,15 @@ toggle_reftrace_printer(PyObject *ob, PyObject *arg)
25492549
static PyObject *
25502550
test_interp_refcount(PyObject *self, PyObject *unused)
25512551
{
2552-
PyThreadState *save = PyThreadState_Get();
2553-
PyThreadState *tstate = Py_NewInterpreter();
2554-
assert(tstate == PyThreadState_Get());
2555-
PyInterpreterState *interp = PyThreadState_GetInterpreter(tstate);
2556-
assert(interp != NULL);
2552+
PyInterpreterState *interp = PyInterpreterState_Get();
25572553

2554+
// Reference counts are technically 0 by default
25582555
assert(_PyInterpreterState_Refcount(interp) == 0);
25592556
PyInterpreterState *held = PyInterpreterState_Hold();
25602557
assert(_PyInterpreterState_Refcount(interp) == 1);
2561-
PyInterpreterState_Release(held);
2562-
assert(_PyInterpreterState_Refcount(interp) == 0);
2563-
25642558
held = PyInterpreterState_Hold();
2565-
Py_EndInterpreter(tstate);
2566-
PyThreadState_Swap(save);
2559+
assert(_PyInterpreterState_Refcount(interp) == 2);
2560+
PyInterpreterState_Release(held);
25672561
assert(_PyInterpreterState_Refcount(interp) == 1);
25682562
PyInterpreterState_Release(held);
25692563
assert(_PyInterpreterState_Refcount(interp) == 0);

0 commit comments

Comments
 (0)