From cc61e6140f0dfde2ff372db932442cf6df890f09 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 26 Aug 2024 11:46:25 -0400 Subject: [PATCH] Prefer simpler path.rstrip to consolidate checks for empty or only paths. --- zipp/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zipp/__init__.py b/zipp/__init__.py index 0b7b443..a3f0b1b 100644 --- a/zipp/__init__.py +++ b/zipp/__init__.py @@ -65,7 +65,7 @@ def _ancestry(path): ['//b//d///f', '//b//d', '//b'] """ path = path.rstrip(posixpath.sep) - while path and not path.endswith(posixpath.sep): + while path.rstrip(posixpath.sep): yield path path, tail = posixpath.split(path)