https://github.com/python/cpython/commit/027f58473cf1abda4c20cfc0852b4749c3a12932
commit: 027f58473cf1abda4c20cfc0852b4749c3a12932
branch: 3.14
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: vstinner <vstin...@python.org>
date: 2025-06-16T16:37:26Z
summary:

[3.14] gh-135513: Fix unused variable warning in `crossinterp.c` (GH-135514) 
(#135577)

gh-135513: Fix unused variable warning in `crossinterp.c` (GH-135514)
(cherry picked from commit 4c15505071498439407483004721d0369f110229)

Co-authored-by: sobolevn <m...@sobolevn.me>

files:
M Python/crossinterp.c

diff --git a/Python/crossinterp.c b/Python/crossinterp.c
index 39c7ea698904bd..0bd267e07d5f2b 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 @@ _PyXI_Enter(_PyXI_session *session,
 
     // Exit the session.
     _exit_session(session);
+#ifndef NDEBUG
     tstate = _PyThreadState_GET();
+#endif
 
     if (sharedns != NULL) {
         _destroy_sharedns(sharedns);

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: arch...@mail-archive.com

Reply via email to