From 7d0754fa93fb5cec0e9428c9219fff3df154556f Mon Sep 17 00:00:00 2001 From: Valery Fedorenko Date: Thu, 31 Oct 2024 09:36:29 +0800 Subject: [PATCH] Apply suggession for Python/sysmodule.c Co-authored-by: Peter Bierma --- Python/sysmodule.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 3a2326e09700d3..6a861da49b8216 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -2862,6 +2862,8 @@ PyAPI_FUNC(void) PySys_AddWarnOptionUnicode(PyObject *option) { PyThreadState *tstate = _PyThreadState_GET(); + _Py_EnsureTstateNotNULL(tstate); + assert(!_PyErr_Occurred(tstate)); if (_PySys_AddWarnOptionWithError(tstate, option) < 0) { /* No return value, therefore clear error state if possible */ _PyErr_Clear(tstate);