From: sobolevn Date: Mon, 16 Jun 2025 16:12:20 +0000 (+0300) Subject: gh-135513: Fix unused variable warning in `crossinterp.c` (#135514) X-Git-Tag: v3.15.0a1~1290 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4c15505071498439407483004721d0369f110229;p=thirdparty%2FPython%2Fcpython.git gh-135513: Fix unused variable warning in `crossinterp.c` (#135514) --- diff --git a/Python/crossinterp.c b/Python/crossinterp.c index 39c7ea698904..0bd267e07d5f 100644 --- a/Python/crossinterp.c +++ b/Python/crossinterp.c @@ -2619,7 +2619,9 @@ _PyXI_Enter(_PyXI_session *session, PyInterpreterState *interp, PyObject *nsupdates, _PyXI_session_result *result) { - PyThreadState *tstate = _PyThreadState_GET(); +#ifndef NDEBUG + PyThreadState *tstate = _PyThreadState_GET(); // Only used for asserts +#endif // Convert the attrs for cross-interpreter use. _PyXI_namespace *sharedns = NULL; @@ -2661,7 +2663,9 @@ _PyXI_Enter(_PyXI_session *session, _enter_session(session, interp); _PyXI_failure override = XI_FAILURE_INIT; override.code = _PyXI_ERR_UNCAUGHT_EXCEPTION; +#ifndef NDEBUG tstate = _PyThreadState_GET(); +#endif // Ensure this thread owns __main__. if (_PyInterpreterState_SetRunningMain(interp) < 0) { @@ -2697,7 +2701,9 @@ error: // Exit the session. _exit_session(session); +#ifndef NDEBUG tstate = _PyThreadState_GET(); +#endif if (sharedns != NULL) { _destroy_sharedns(sharedns);