diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-05-17 15:16:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-17 15:16:58 (GMT) |
commit | ced71d39cfc2ab6e227824fe891101dcb473c2e3 (patch) | |
tree | 80b0bb5f4fe7fbfe0389c5a37097b5213a37632b /Python | |
parent | ada4ad0e247279f54e7e2f90397075fb65bb9b5d (diff) | |
download | cpython-ced71d39cfc2ab6e227824fe891101dcb473c2e3.zip cpython-ced71d39cfc2ab6e227824fe891101dcb473c2e3.tar.gz cpython-ced71d39cfc2ab6e227824fe891101dcb473c2e3.tar.bz2 |
[3.13] gh-119049: Fix incorrect display of warning which is constructed by C API (GH-119063) (GH-119106)
The source line was not displayed if the warnings module had not yet
been imported.
(cherry picked from commit 100c7ab00ab66a8c0d54582f35e38d8eb691743c)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Diffstat (limited to 'Python')
-rw-r--r-- | Python/_warnings.c | 5 |
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; |