summaryrefslogtreecommitdiff
path: root/Lib/pathlib.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-08-28 22:05:59 -0700
committerNed Deily <nad@python.org>2019-08-29 01:05:59 -0400
commit4adcaf81513e57a2a4e278073a89efb1375af8df (patch)
tree5d821132440bf02d482e501c234168185167fe22 /Lib/pathlib.py
parente471a543a4f7c52a8d0081ec5142adab3416d8fb (diff)
downloadcpython-git-4adcaf81513e57a2a4e278073a89efb1375af8df.tar.gz
bpo-34775: Return NotImplemented in PurePath division. (GH-9509) (GH-15172)
(cherry picked from commit 4c69be22df3852f17873a74d015528d9a8ae92d6) Co-authored-by: aiudirog <aiudirog@gmail.com>
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r--Lib/pathlib.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index 6369c4b221..6355ae8641 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):