Skip to content

Commit 5bb6bb2

Browse files
committed
Match implementation in python#134101
1 parent 78a368a commit 5bb6bb2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Lib/pathlib/_os.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,12 @@ def vfspath(obj):
216216
"""
217217
cls = type(obj)
218218
try:
219-
return cls.__vfspath__(obj)
219+
vfspath_method = cls.__vfspath__
220220
except AttributeError:
221-
if hasattr(cls, '__vfspath__'):
222-
raise
223-
224-
raise TypeError("expected JoinablePath object, not " + cls.__name__)
221+
cls_name = cls.__name__
222+
raise TypeError(f"expected JoinablePath object, not {cls_name}") from None
223+
else:
224+
return vfspath_method(obj)
225225

226226

227227
def ensure_distinct_paths(source, target):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy