https://github.com/python/cpython/commit/4c15505071498439407483004721d0369f110229
commit: 4c15505071498439407483004721d0369f110229
branch: main
author: sobolevn <[email protected]>
committer: vstinner <[email protected]>
date: 2025-06-16T18:12:20+02:00
summary:
gh-135513: Fix unused variable warning in `crossinterp.c` (#135514)
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 -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]