]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-135513: Fix unused variable warning in `crossinterp.c` (GH-135514) (#135577)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 16 Jun 2025 16:37:26 +0000 (18:37 +0200)
committerGitHub <noreply@github.com>
Mon, 16 Jun 2025 16:37:26 +0000 (16:37 +0000)
gh-135513: Fix unused variable warning in `crossinterp.c` (GH-135514)
(cherry picked from commit 4c15505071498439407483004721d0369f110229)

Co-authored-by: sobolevn <mail@sobolevn.me>
Python/crossinterp.c

index 39c7ea698904bd0ff60c805253e8962288b7e1b5..0bd267e07d5f2bf778fe604032bb0fd6ac188f7c 100644 (file)
@@ -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);