bpo-30860: Fix a refleak. (#3506)
* Drop warnoptions from PyInterpreterState.
* Drop xoptions from PyInterpreterState.
* Don't set warnoptions and _xoptions again.
* Decref after adding to sys.__dict__.
* Drop an unused macro.
* Check sys.xoptions *before* we delete it.
diff --git a/Include/object.h b/Include/object.h
index b46d4c3..9bb780e 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -727,14 +727,13 @@
/* Py_REF_DEBUG also controls the display of refcounts and memory block
* allocations at the interactive prompt and at interpreter shutdown
*/
+PyAPI_FUNC(PyObject *) _PyDebug_XOptionShowRefCount(void);
PyAPI_FUNC(void) _PyDebug_PrintTotalRefs(void);
-#define _PY_DEBUG_PRINT_TOTAL_REFS() _PyDebug_PrintTotalRefs()
#else
#define _Py_INC_REFTOTAL
#define _Py_DEC_REFTOTAL
#define _Py_REF_DEBUG_COMMA
#define _Py_CHECK_REFCNT(OP) /* a semicolon */;
-#define _PY_DEBUG_PRINT_TOTAL_REFS()
#endif /* Py_REF_DEBUG */
#ifdef COUNT_ALLOCS