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
e430073f
Commit
e430073f
authored
Sep 27, 2014
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #9850: Fixed macpath.join() for empty first component. Patch by
Oleg Oshmyan.
parent
6e7c1401
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
Lib/macpath.py
Lib/macpath.py
+1
-1
Lib/test/test_macpath.py
Lib/test/test_macpath.py
+20
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/macpath.py
View file @
e430073f
...
...
@@ -42,7 +42,7 @@ def isabs(s):
def
join
(
s
,
*
p
):
path
=
s
for
t
in
p
:
if
(
not
s
)
or
isabs
(
t
):
if
(
not
path
)
or
isabs
(
t
):
path
=
t
continue
if
t
[:
1
]
==
':'
:
...
...
Lib/test/test_macpath.py
View file @
e430073f
...
...
@@ -29,6 +29,26 @@ class MacPathTestCase(unittest.TestCase):
self
.
assertEqual
(
split
(
":conky:mountpoint:"
),
(
':conky:mountpoint'
,
''
))
def
test_join
(
self
):
join
=
macpath
.
join
self
.
assertEqual
(
join
(
'a'
,
'b'
),
':a:b'
)
self
.
assertEqual
(
join
(
':a'
,
'b'
),
':a:b'
)
self
.
assertEqual
(
join
(
':a:'
,
'b'
),
':a:b'
)
self
.
assertEqual
(
join
(
':a::'
,
'b'
),
':a::b'
)
self
.
assertEqual
(
join
(
':a'
,
'::b'
),
':a::b'
)
self
.
assertEqual
(
join
(
'a'
,
':'
),
':a:'
)
self
.
assertEqual
(
join
(
'a:'
,
':'
),
'a:'
)
self
.
assertEqual
(
join
(
'a'
,
''
),
':a:'
)
self
.
assertEqual
(
join
(
'a:'
,
''
),
'a:'
)
self
.
assertEqual
(
join
(
''
,
''
),
''
)
self
.
assertEqual
(
join
(
''
,
'a:b'
),
'a:b'
)
self
.
assertEqual
(
join
(
''
,
'a'
,
'b'
),
':a:b'
)
self
.
assertEqual
(
join
(
'a:b'
,
'c'
),
'a:b:c'
)
self
.
assertEqual
(
join
(
'a:b'
,
':c'
),
'a:b:c'
)
self
.
assertEqual
(
join
(
'a'
,
':b'
,
':c'
),
':a:b:c'
)
self
.
assertEqual
(
join
(
'a'
,
'b:'
),
'b:'
)
self
.
assertEqual
(
join
(
'a:'
,
'b:'
),
'b:'
)
def
test_splitext
(
self
):
splitext
=
macpath
.
splitext
self
.
assertEqual
(
splitext
(
":foo.ext"
),
(
':foo'
,
'.ext'
))
...
...
Misc/NEWS
View file @
e430073f
...
...
@@ -22,6 +22,9 @@ Core and Builtins
Library
-------
-
Issue
#
9850
:
Fixed
macpath
.
join
()
for
empty
first
component
.
Patch
by
Oleg
Oshmyan
.
-
Issue
#
20912
:
Now
directories
added
to
ZIP
file
have
correct
Unix
and
MS
-
DOS
directory
attributes
.
...
...
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