mirror of
https://github.com/python/cpython.git
synced 2025-12-09 10:37:17 +00:00
GH-103525: Improve exception message from pathlib.PurePath() (GH-103526)
Check that arguments are strings before calling `os.path.join()`. Also improve performance of `PurePath(PurePath(...))` while we're in the area: we now use the *unnormalized* string path of such arguments. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
parent
d81ca7ec02
commit
8611e7bf5c
3 changed files with 27 additions and 16 deletions
|
|
@ -81,9 +81,9 @@ class _BasePurePathTest(object):
|
|||
r"where __fspath__ returns a str, not 'bytes'")
|
||||
with self.assertRaisesRegex(TypeError, message):
|
||||
P(b'a')
|
||||
with self.assertRaises(TypeError):
|
||||
with self.assertRaisesRegex(TypeError, message):
|
||||
P(b'a', 'b')
|
||||
with self.assertRaises(TypeError):
|
||||
with self.assertRaisesRegex(TypeError, message):
|
||||
P('a', b'b')
|
||||
with self.assertRaises(TypeError):
|
||||
P('a').joinpath(b'b')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue