Skip to content

Commit 027f584

Browse files
[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 4c15505) Co-authored-by: sobolevn <[email protected]>
1 parent 0e0ad7b commit 027f584

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Python/crossinterp.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2619,7 +2619,9 @@ _PyXI_Enter(_PyXI_session *session,
26192619
PyInterpreterState *interp, PyObject *nsupdates,
26202620
_PyXI_session_result *result)
26212621
{
2622-
PyThreadState *tstate = _PyThreadState_GET();
2622+
#ifndef NDEBUG
2623+
PyThreadState *tstate = _PyThreadState_GET(); // Only used for asserts
2624+
#endif
26232625

26242626
// Convert the attrs for cross-interpreter use.
26252627
_PyXI_namespace *sharedns = NULL;
@@ -2661,7 +2663,9 @@ _PyXI_Enter(_PyXI_session *session,
26612663
_enter_session(session, interp);
26622664
_PyXI_failure override = XI_FAILURE_INIT;
26632665
override.code = _PyXI_ERR_UNCAUGHT_EXCEPTION;
2666+
#ifndef NDEBUG
26642667
tstate = _PyThreadState_GET();
2668+
#endif
26652669

26662670
// Ensure this thread owns __main__.
26672671
if (_PyInterpreterState_SetRunningMain(interp) < 0) {
@@ -2697,7 +2701,9 @@ _PyXI_Enter(_PyXI_session *session,
26972701

26982702
// Exit the session.
26992703
_exit_session(session);
2704+
#ifndef NDEBUG
27002705
tstate = _PyThreadState_GET();
2706+
#endif
27012707

27022708
if (sharedns != NULL) {
27032709
_destroy_sharedns(sharedns);

0 commit comments

Comments
 (0)