[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>
4 files changed