https://github.com/python/cpython/commit/ddf95b5f16031cdbd0d728e55eb06dff002a8678
commit: ddf95b5f16031cdbd0d728e55eb06dff002a8678
branch: main
author: Erlend E. Aasland <[email protected]>
committer: erlend-aasland <[email protected]>
date: 2024-03-29T17:26:06Z
summary:
gh-116664: Fix unused var warnings in _warnings.c in non-free-threaded builds
(#117373)
The warnings were introduced by commit c1712ef06.
files:
M Python/_warnings.c
diff --git a/Python/_warnings.c b/Python/_warnings.c
index 66a460e2a2c509..ac3d3cc2d1246b 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -994,8 +994,10 @@ do_warn(PyObject *message, PyObject *category, Py_ssize_t
stack_level,
&filename, &lineno, &module, ®istry))
return NULL;
+#ifdef Py_GIL_DISABLED
WarningsState *st = warnings_get_state(tstate->interp);
assert(st != NULL);
+#endif
Py_BEGIN_CRITICAL_SECTION_MUT(&st->mutex);
res = warn_explicit(tstate, category, message, filename, lineno, module,
registry,
@@ -1149,8 +1151,10 @@ warnings_warn_explicit_impl(PyObject *module, PyObject
*message,
}
}
+#ifdef Py_GIL_DISABLED
WarningsState *st = warnings_get_state(tstate->interp);
assert(st != NULL);
+#endif
Py_BEGIN_CRITICAL_SECTION_MUT(&st->mutex);
returned = warn_explicit(tstate, category, message, filename, lineno,
@@ -1296,8 +1300,10 @@ PyErr_WarnExplicitObject(PyObject *category, PyObject
*message,
return -1;
}
+#ifdef Py_GIL_DISABLED
WarningsState *st = warnings_get_state(tstate->interp);
assert(st != NULL);
+#endif
Py_BEGIN_CRITICAL_SECTION_MUT(&st->mutex);
res = warn_explicit(tstate, category, message, filename, lineno,
@@ -1367,8 +1373,10 @@ PyErr_WarnExplicitFormat(PyObject *category,
PyObject *res;
PyThreadState *tstate = get_current_tstate();
if (tstate != NULL) {
+#ifdef Py_GIL_DISABLED
WarningsState *st = warnings_get_state(tstate->interp);
assert(st != NULL);
+#endif
Py_BEGIN_CRITICAL_SECTION_MUT(&st->mutex);
res = warn_explicit(tstate, category, message, filename, lineno,
_______________________________________________
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]