We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 78a368a commit 5bb6bb2Copy full SHA for 5bb6bb2
Lib/pathlib/_os.py
@@ -216,12 +216,12 @@ def vfspath(obj):
216
"""
217
cls = type(obj)
218
try:
219
- return cls.__vfspath__(obj)
+ vfspath_method = cls.__vfspath__
220
except AttributeError:
221
- if hasattr(cls, '__vfspath__'):
222
- raise
223
-
224
- raise TypeError("expected JoinablePath object, not " + cls.__name__)
+ cls_name = cls.__name__
+ raise TypeError(f"expected JoinablePath object, not {cls_name}") from None
+ else:
+ return vfspath_method(obj)
225
226
227
def ensure_distinct_paths(source, target):
0 commit comments