This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fix warning in _PyPathConfig_ComputeArgv0
Type: Stage: resolved
Components: Versions: Python 3.8
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: matrixise, pablogsal, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2019-03-15 20:25 by matrixise, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 12357 closed matrixise, 2019-03-15 20:28
Messages (6)
msg338027 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-03-15 20:25
Python/pathconfig.c: In function '_PyPathConfig_ComputeArgv0':
Python/pathconfig.c:615:26: warning: 'argv0' may be used uninitialized in this function [-Wmaybe-uninitialized]
             wchar_t *q = wcsrchr(argv0, SEP);
                          ^~~~~~~~~~~~~~~~~~~
msg338029 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-03-15 20:31
@vstinner

I just initialized argv0 to NULL but the wcsrchr could generate a SIGSEGV.

What do you suggest for the initial value of argv0? try to detect the sys.executable and use it for argv0?
msg338369 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2019-03-19 15:54
This issue is already been handled in https://github.com/python/cpython/pull/12441
msg338370 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-03-19 15:56
Yep, Victor has started the refactoring/cleaning after my PR, but I close this one and the issue.
msg338373 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2019-03-19 16:04
Thanks for the time detecting this, opening this issue and the PR (and all the others), Stéphane! :)
msg338374 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-03-19 16:10
That was funny to use gdb and valgrind for the debugging session. Now I can help you for the refleaks ;-)
History
Date User Action Args
2022-04-11 14:59:12adminsetgithub: 80489
2019-03-19 16:10:41matrixisesetmessages: + msg338374
2019-03-19 16:04:57pablogsalsetmessages: + msg338373
2019-03-19 15:56:32matrixisesetstatus: open -> closed

messages: + msg338370
stage: resolved
2019-03-19 15:54:24pablogsalsetnosy: + pablogsal
messages: + msg338369
2019-03-17 17:44:18matrixisesetnosy: + serhiy.storchaka
2019-03-15 20:31:19matrixisesetmessages: + msg338029
stage: patch review -> (no value)
2019-03-15 20:28:50matrixisesetkeywords: + patch
stage: patch review
pull_requests: + pull_request12324
2019-03-15 20:25:34matrixisecreate