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: platform.libc_ver() doesn't consider in case of executable is empty string
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: kurochan, lemburg, vstinner
Priority: normal Keywords: patch

Created on 2020-11-04 06:01 by kurochan, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 23140 merged kurochan, 2020-11-04 06:17
Messages (9)
msg380311 - (view) Author: Kurochan (kurochan) * Date: 2020-11-04 06:01
Currently, `platform.libc_ver()` doesn't consider in case of `executable` variable is an empty string.
However, with Python 3.8, the following code could pass an empty string `executable` to the `platform.libc_ver()` function.

https://github.com/python/cpython/blob/efc782d29e229924076ffb6645a72f26242fb3ef/Lib/platform.py#L1205
https://docs.python.org/3/library/sys.html#sys.executable

Because the `sys.executable` could return an empty string, so I would like to add the empty string handler.

https://github.com/python/cpython/blob/efc782d29e229924076ffb6645a72f26242fb3ef/Lib/platform.py#L174

Or please also merge the following PR to Python 3.8.
https://github.com/python/cpython/pull/14418
msg383523 - (view) Author: Kurochan (kurochan) * Date: 2020-12-21 14:05
Can anyone review this PR?
msg383891 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2020-12-28 12:38
Reviewed. Please check on the PR for comments.
msg383892 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-28 13:16
> Currently, `platform.libc_ver()` doesn't consider in case of `executable` variable is an empty string.

I'm curious. In which case sys.executable is an empty string? Do you embed Python in an application. If Python is embedded, would it be possible to share the code used to configure Python initialization?
msg384118 - (view) Author: Kurochan (kurochan) * Date: 2020-12-31 13:51
> If Python is embedded

Yes. It's embedded Python.
This issue caused in datadog-agent with embedded Python.
https://github.com/DataDog/datadog-agent/

>  would it be possible to share the code used to configure Python initialization?
I'm not sure where the Python installation code is. Maybe it's around here.
https://github.com/DataDog/datadog-agent/blob/master/docs/dev/agent_omnibus.md

https://github.com/DataDog/datadog-agent/blob/master/omnibus/config/software/python3.rb

datadog-agent's official install script is here.
https://s3.amazonaws.com/dd-agent/scripts/install_script.sh
msg384120 - (view) Author: Kurochan (kurochan) * Date: 2020-12-31 14:10
Also, PR comment processed.
msg384121 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2020-12-31 14:43
Thanks for the patch.

Merging is currently prevented by an unrelated test for nntplib failing. See e.g. https://github.com/python/cpython/pull/23140/checks?check_run_id=1630509357. This is being tracked in https://bugs.python.org/issue42794
msg384225 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2021-01-02 16:08
https://github.com/python/cpython/pull/23140 merged. Thanks for the patch, Kurochan.
msg384226 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2021-01-02 16:10
Note: I did not request a backport, since this really is a new feature.
History
Date User Action Args
2022-04-11 14:59:37adminsetgithub: 86423
2021-01-02 16:10:14lemburgsetmessages: + msg384226
2021-01-02 16:08:47lemburgsetstatus: open -> closed

messages: + msg384225
stage: patch review -> resolved
2020-12-31 14:43:33lemburgsetmessages: + msg384121
2020-12-31 14:10:48kurochansetmessages: + msg384120
2020-12-31 13:51:57kurochansetmessages: + msg384118
2020-12-28 13:16:44vstinnersetnosy: + vstinner
messages: + msg383892
2020-12-28 12:38:16lemburgsetmessages: + msg383891
2020-12-26 01:33:34ned.deilysetnosy: + lemburg
2020-12-21 14:05:35kurochansetmessages: + msg383523
2020-11-04 06:17:23kurochansetkeywords: + patch
stage: patch review
pull_requests: + pull_request22053
2020-11-04 06:01:55kurochancreate