summaryrefslogtreecommitdiffstats
path: root/Python/_warnings.c
diff options
context:
space:
mode:
authorKirill Podoprigora <kirill.bast9@mail.ru>2024-05-16 20:27:59 (GMT)
committerGitHub <noreply@github.com>2024-05-16 20:27:59 (GMT)
commit100c7ab00ab66a8c0d54582f35e38d8eb691743c (patch)
tree64dc41a7a3be5a41790d7c8c197eeedf294ab4fb /Python/_warnings.c
parent4702b7b5bdc07d046576b4126cf4e4f5f7145abb (diff)
downloadcpython-100c7ab00ab66a8c0d54582f35e38d8eb691743c.zip
cpython-100c7ab00ab66a8c0d54582f35e38d8eb691743c.tar.gz
cpython-100c7ab00ab66a8c0d54582f35e38d8eb691743c.tar.bz2
gh-119049: Fix incorrect display of warning which is constructed by C API (GH-119063)
The source line was not displayed if the warnings module had not yet been imported.
Diffstat (limited to 'Python/_warnings.c')
-rw-r--r--Python/_warnings.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c
index 793cbc6..17404d3 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -569,10 +569,9 @@ call_show_warning(PyThreadState *tstate, PyObject *category,
PyObject *show_fn, *msg, *res, *warnmsg_cls = NULL;
PyInterpreterState *interp = tstate->interp;
- /* If the source parameter is set, try to get the Python implementation.
- The Python implementation is able to log the traceback where the source
+ /* The Python implementation is able to log the traceback where the source
was allocated, whereas the C implementation doesn't. */
- show_fn = GET_WARNINGS_ATTR(interp, _showwarnmsg, source != NULL);
+ show_fn = GET_WARNINGS_ATTR(interp, _showwarnmsg, 1);
if (show_fn == NULL) {
if (PyErr_Occurred())
return -1;