diff options
author | aiudirog <aiudirog@gmail.com> | 2019-08-08 05:41:10 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2019-08-08 05:41:10 (GMT) |
commit | 4c69be22df3852f17873a74d015528d9a8ae92d6 (patch) | |
tree | d0f30d3f81f17f85594408e9e5705a678c98f851 /Lib/pathlib.py | |
parent | 0378d98678f3617fd44d9a6266e7c17ebce62755 (diff) | |
download | cpython-4c69be22df3852f17873a74d015528d9a8ae92d6.zip cpython-4c69be22df3852f17873a74d015528d9a8ae92d6.tar.gz cpython-4c69be22df3852f17873a74d015528d9a8ae92d6.tar.bz2 |
bpo-34775: Return NotImplemented in PurePath division. (GH-9509)
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r-- | Lib/pathlib.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py index 6369c4b..6355ae8 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -907,10 +907,16 @@ class PurePath(object): return self._make_child(args) def __truediv__(self, key): - return self._make_child((key,)) + try: + return self._make_child((key,)) + except TypeError: + return NotImplemented def __rtruediv__(self, key): - return self._from_parts([key] + self._parts) + try: + return self._from_parts([key] + self._parts) + except TypeError: + return NotImplemented @property def parent(self): |