diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2024-06-03 15:13:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-03 15:13:07 (GMT) |
commit | 42a34ddb0b63e638905b01e17a7254623a0de427 (patch) | |
tree | 91a5a67346c3d852f8587a8a7369d7448f7ec5bb /Lib/zipfile | |
parent | fd01271366abefa8f991e53f090387882fbd6bdd (diff) | |
download | cpython-42a34ddb0b63e638905b01e17a7254623a0de427.zip cpython-42a34ddb0b63e638905b01e17a7254623a0de427.tar.gz cpython-42a34ddb0b63e638905b01e17a7254623a0de427.tar.bz2 |
gh-119588: Implement zipfile.Path.is_symlink (zipp 3.19.0). (#119591)
Diffstat (limited to 'Lib/zipfile')
-rw-r--r-- | Lib/zipfile/_path/__init__.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/zipfile/_path/__init__.py b/Lib/zipfile/_path/__init__.py index 79ebb77..f5ea18c 100644 --- a/Lib/zipfile/_path/__init__.py +++ b/Lib/zipfile/_path/__init__.py @@ -5,6 +5,7 @@ import itertools import contextlib import pathlib import re +import stat import sys from .glob import Translator @@ -390,9 +391,11 @@ class Path: def is_symlink(self): """ - Return whether this path is a symlink. Always false (python/cpython#82102). + Return whether this path is a symlink. """ - return False + info = self.root.getinfo(self.at) + mode = info.external_attr >> 16 + return stat.S_ISLNK(mode) def glob(self, pattern): if not pattern: |