File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2549,21 +2549,15 @@ toggle_reftrace_printer(PyObject *ob, PyObject *arg)
25492549static PyObject *
25502550test_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 );
You can’t perform that action at this time.
0 commit comments