Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
423d05f6
Commit
423d05f6
authored
Aug 11, 2018
by
Berker Peksag
Committed by
GitHub
Aug 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-34333: Fix %-formatting in Path.with_suffix() (GH-8663)
parent
077059e0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
1 deletion
+5
-1
Lib/pathlib.py
Lib/pathlib.py
+1
-1
Lib/test/test_pathlib.py
Lib/test/test_pathlib.py
+2
-0
Misc/NEWS.d/next/Library/2018-08-04-00-06-28.bpo-34333.5NHG93.rst
...S.d/next/Library/2018-08-04-00-06-28.bpo-34333.5NHG93.rst
+2
-0
No files found.
Lib/pathlib.py
View file @
423d05f6
...
@@ -813,7 +813,7 @@ class PurePath(object):
...
@@ -813,7 +813,7 @@ class PurePath(object):
"""
"""
f
=
self
.
_flavour
f
=
self
.
_flavour
if
f
.
sep
in
suffix
or
f
.
altsep
and
f
.
altsep
in
suffix
:
if
f
.
sep
in
suffix
or
f
.
altsep
and
f
.
altsep
in
suffix
:
raise
ValueError
(
"Invalid suffix %r"
%
(
suffix
))
raise
ValueError
(
"Invalid suffix %r"
%
(
suffix
,
))
if
suffix
and
not
suffix
.
startswith
(
'.'
)
or
suffix
==
'.'
:
if
suffix
and
not
suffix
.
startswith
(
'.'
)
or
suffix
==
'.'
:
raise
ValueError
(
"Invalid suffix %r"
%
(
suffix
))
raise
ValueError
(
"Invalid suffix %r"
%
(
suffix
))
name
=
self
.
name
name
=
self
.
name
...
...
Lib/test/test_pathlib.py
View file @
423d05f6
...
@@ -577,6 +577,8 @@ class _BasePurePathTest(object):
...
@@ -577,6 +577,8 @@ class _BasePurePathTest(object):
self
.
assertRaises
(
ValueError
,
P
(
'a/b'
).
with_suffix
,
'.c/.d'
)
self
.
assertRaises
(
ValueError
,
P
(
'a/b'
).
with_suffix
,
'.c/.d'
)
self
.
assertRaises
(
ValueError
,
P
(
'a/b'
).
with_suffix
,
'./.d'
)
self
.
assertRaises
(
ValueError
,
P
(
'a/b'
).
with_suffix
,
'./.d'
)
self
.
assertRaises
(
ValueError
,
P
(
'a/b'
).
with_suffix
,
'.d/.'
)
self
.
assertRaises
(
ValueError
,
P
(
'a/b'
).
with_suffix
,
'.d/.'
)
self
.
assertRaises
(
ValueError
,
P
(
'a/b'
).
with_suffix
,
(
self
.
flavour
.
sep
,
'd'
))
def
test_relative_to_common
(
self
):
def
test_relative_to_common
(
self
):
P
=
self
.
cls
P
=
self
.
cls
...
...
Misc/NEWS.d/next/Library/2018-08-04-00-06-28.bpo-34333.5NHG93.rst
0 → 100644
View file @
423d05f6
Fix %-formatting in :meth:`pathlib.PurePath.with_suffix` when formatting an
error message.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment