-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed as not planned
Labels
type-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
In the common case we go from 2 condition checks to 1:
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index fccca4e066b76f..89d8267d927c65 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -428,13 +428,14 @@ def _realpath(filename, strict=False, sep=sep, curdir=curdir, pardir=pardir,
while rest:
name = rest.pop()
- if name is None:
- # resolved symlink target
- seen[rest.pop()] = path
- continue
if not name or name == curdir:
- # current dir
- continue
+ if name is None:
+ # resolved symlink target
+ seen[rest.pop()] = path
+ continue
+ else:
+ # current dir
+ continue
if name == pardir:
# parent dir
path = path[:path.rindex(sep)] or sep
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
Linked PRs
Metadata
Metadata
Assignees
Labels
type-featureA feature request or enhancementA feature request or enhancement