| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM.
Sorry, something went wrong.
There was a problem hiding this comment.
On other hand, what happens when it is called at the late stage of Python shutdown, when import does not work? Does it emit any warning or raise an exception?
Sorry, something went wrong.
No, it's just omit the source in the warning. Should we emit warning or raise a exception? |
Sorry, something went wrong.
|
How difficult is to write a test for this case? |
Sorry, something went wrong.
It's not difficult. |
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you for the new test. Even if its result was not affected by this change, it is nice to check this.
Sorry, something went wrong.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
There was a problem hiding this comment.
LGTM.
Sorry, something went wrong.
|
A NEWS entry is needed since this is a user visible change. |
Sorry, something went wrong.
|
Thanks for the review, Serhiy. |
Sorry, something went wrong.
|
Thanks @Eclips4 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
Sorry, something went wrong.
…d by C API (pythonGH-119063) The source line was not displayed if the warnings module had not yet been imported. (cherry picked from commit 100c7ab) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
|
Sorry, @Eclips4 and @serhiy-storchaka, I could not cleanly backport this to 3.12 due to a conflict. cherry_picker 100c7ab00ab66a8c0d54582f35e38d8eb691743c 3.12 |
Sorry, something went wrong.
|
GH-119106 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
|
@serhiy-storchaka I'm trying to do backport to the 3.12 branch manually, and realize that this cannot be done without the backport of e1d8c65. |
Sorry, something went wrong.
|
Is it because of passing the code via the -c option? Then I guess we can just write it into a file. |
Sorry, something went wrong.
|
GH-119119 is a backport of this pull request to the 3.12 branch. |
Sorry, something went wrong.
Yes, you're right! Thanks for the hint. Check please the #119119. |
Sorry, something went wrong.
…d by C API (pythonGH-119063) The source line was not displayed if the warnings module had not yet been imported.
| Back | FazBrowse Home | New Git URL |
GET_WARNINGS_ATTR is trying to get the ATTR attribute of the Python warnings module. If the third parameter is true, it tries to import the warnings module if it hasn't been imported already.
All of the calls to call_show_warning are made with the source = NULL argument, so this statement show_fn = GET_WARNINGS_ATTR(interp, _showwarnmsg, source != NULL); always becomes show_fn = GET_WARNINGS_ATTR(interp, _showwarnmsg, 0);.
So it never triess to import the warnings module if it has not already imported, which leads us to the issue described in the #119049.
This is why test_io.test_check_encoding_warning works when import warnings is used in pathlib._local.py and fails when we remove this statement.