]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Remove compatibility check for Python versions below 2.2. (GH-28314)
authorOmer Katz <omer.drow@gmail.com>
Fri, 17 Sep 2021 13:36:41 +0000 (16:36 +0300)
committerGitHub <noreply@github.com>
Fri, 17 Sep 2021 13:36:41 +0000 (15:36 +0200)
`os.path.realpath()` already exists in all our supported Python versions.
There's no longer a need to check if it exists or not.

Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Lib/platform.py

index 0f17964da41002e1fe9b2ab8d6071ad00c04444e..240f701754d4acc08c0d9f7d2d2c7d3a891c1ea5 100755 (executable)
@@ -187,11 +187,10 @@ def libc_ver(executable=None, lib='', version='', chunksize=16384):
         executable = sys.executable
 
     V = _comparable_version
-    if hasattr(os.path, 'realpath'):
-        # Python 2.2 introduced os.path.realpath(); it is used
-        # here to work around problems with Cygwin not being
-        # able to open symlinks for reading
-        executable = os.path.realpath(executable)
+    # We use os.path.realpath()
+    # here to work around problems with Cygwin not being
+    # able to open symlinks for reading
+    executable = os.path.realpath(executable)
     with open(executable, 'rb') as f:
         binary = f.read(chunksize)
         pos = 0