[Python-checkins] handle empty string in variable executable in platform.libc_ver() (#23140)

malemburg webhook-mailer at python.org
Sat Jan 2 11:04:00 EST 2021


https://github.com/python/cpython/commit/d9142831ba6780eef47bb68e878cf2f8910c4ab2
commit: d9142831ba6780eef47bb68e878cf2f8910c4ab2
branch: master
author: Kurochan <kuro at kurochan.org>
committer: malemburg <mal at lemburg.com>
date: 2021-01-02T17:03:53+01:00
summary:

handle empty string in variable executable in platform.libc_ver() (#23140)

files:
A Misc/NEWS.d/next/Library/2020-12-31-23-05-53.bpo-42257.ALQy7B.rst
M Lib/platform.py

diff --git a/Lib/platform.py b/Lib/platform.py
index 985e12d9684ea..d567dd1a6e1ad 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -174,7 +174,7 @@ def libc_ver(executable=None, lib='', version='', chunksize=16384):
         The file is read and scanned in chunks of chunksize bytes.
 
     """
-    if executable is None:
+    if not executable:
         try:
             ver = os.confstr('CS_GNU_LIBC_VERSION')
             # parse 'glibc 2.28' as ('glibc', '2.28')
diff --git a/Misc/NEWS.d/next/Library/2020-12-31-23-05-53.bpo-42257.ALQy7B.rst b/Misc/NEWS.d/next/Library/2020-12-31-23-05-53.bpo-42257.ALQy7B.rst
new file mode 100644
index 0000000000000..9a026d5cdda27
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-12-31-23-05-53.bpo-42257.ALQy7B.rst
@@ -0,0 +1 @@
+Handle empty string in variable executable in platform.libc_ver()



More information about the Python-checkins mailing list