aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/posixpath.py
diff options
context:
space:
mode:
authorNice Zombies <nineteendo19d0@gmail.com>2024-04-14 23:04:14 +0200
committerGitHub <noreply@github.com>2024-04-14 14:04:14 -0700
commit9ee94d139197c0df8f4e096957576d124ad31c8e (patch)
tree5f04ffc164850be079ff9da1f17297d1d31219f9 /Lib/posixpath.py
parente01831760e3c7cb9cdba78b048c8052808a3a663 (diff)
downloadcpython-9ee94d139197c0df8f4e096957576d124ad31c8e.tar.gz
cpython-9ee94d139197c0df8f4e096957576d124ad31c8e.zip
gh-117636: Remove redundant type check in `os.path.join()` (#117638)
Diffstat (limited to 'Lib/posixpath.py')
-rw-r--r--Lib/posixpath.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index 8fd49cdc358..dd29fbb1614 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -77,13 +77,11 @@ def join(a, *p):
sep = _get_sep(a)
path = a
try:
- if not p:
- path[:0] + sep #23780: Ensure compatible data type even if p is null.
for b in p:
b = os.fspath(b)
- if b.startswith(sep):
+ if b.startswith(sep) or not path:
path = b
- elif not path or path.endswith(sep):
+ elif path.endswith(sep):
path += b
else:
path += sep + b