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
25ec4a45
Commit
25ec4a45
authored
Mar 12, 2019
by
Anthony Sottile
Committed by
Steve Dower
Mar 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-36264: Don't honor POSIX HOME in os.path.expanduser on Windows (GH-12282)
parent
410aea1e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
14 deletions
+17
-14
Lib/distutils/tests/test_config.py
Lib/distutils/tests/test_config.py
+1
-0
Lib/distutils/tests/test_dist.py
Lib/distutils/tests/test_dist.py
+1
-1
Lib/ntpath.py
Lib/ntpath.py
+1
-3
Lib/test/test_netrc.py
Lib/test/test_netrc.py
+1
-0
Lib/test/test_ntpath.py
Lib/test/test_ntpath.py
+11
-10
Misc/NEWS.d/next/Windows/2019-03-11-09-33-47.bpo-36264.rTzWce.rst
...S.d/next/Windows/2019-03-11-09-33-47.bpo-36264.rTzWce.rst
+2
-0
No files found.
Lib/distutils/tests/test_config.py
View file @
25ec4a45
...
...
@@ -60,6 +60,7 @@ class BasePyPIRCCommandTestCase(support.TempdirManager,
super
(
BasePyPIRCCommandTestCase
,
self
).
setUp
()
self
.
tmp_dir
=
self
.
mkdtemp
()
os
.
environ
[
'HOME'
]
=
self
.
tmp_dir
os
.
environ
[
'USERPROFILE'
]
=
self
.
tmp_dir
self
.
rc
=
os
.
path
.
join
(
self
.
tmp_dir
,
'.pypirc'
)
self
.
dist
=
Distribution
()
...
...
Lib/distutils/tests/test_dist.py
View file @
25ec4a45
...
...
@@ -463,7 +463,7 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
# win32-style
if
sys
.
platform
==
'win32'
:
# home drive should be found
os
.
environ
[
'
HOM
E'
]
=
temp_dir
os
.
environ
[
'
USERPROFIL
E'
]
=
temp_dir
files
=
dist
.
find_config_files
()
self
.
assertIn
(
user_filename
,
files
,
'%r not found in %r'
%
(
user_filename
,
files
))
...
...
Lib/ntpath.py
View file @
25ec4a45
...
...
@@ -299,9 +299,7 @@ def expanduser(path):
while
i
<
n
and
path
[
i
]
not
in
_get_bothseps
(
path
):
i
+=
1
if
'HOME'
in
os
.
environ
:
userhome
=
os
.
environ
[
'HOME'
]
elif
'USERPROFILE'
in
os
.
environ
:
if
'USERPROFILE'
in
os
.
environ
:
userhome
=
os
.
environ
[
'USERPROFILE'
]
elif
not
'HOMEPATH'
in
os
.
environ
:
return
path
...
...
Lib/test/test_netrc.py
View file @
25ec4a45
...
...
@@ -154,6 +154,7 @@ class NetrcTestCase(unittest.TestCase):
called
.
append
(
s
)
with
support
.
EnvironmentVarGuard
()
as
environ
:
environ
.
set
(
'HOME'
,
fake_home
)
environ
.
set
(
'USERPROFILE'
,
fake_home
)
result
=
orig_expanduser
(
s
)
return
result
...
...
Lib/test/test_ntpath.py
View file @
25ec4a45
...
...
@@ -262,20 +262,21 @@ class TestNtpath(unittest.TestCase):
env['
USERPROFILE
'] = '
C
:
\\
eric
\\
idle
'
tester('
ntpath
.
expanduser
(
"~test"
)
', '
C
:
\\
eric
\\
test
')
tester('
ntpath
.
expanduser
(
"~"
)
', '
C
:
\\
eric
\\
idle
')
env.clear()
env['
HOME
'] = '
C
:
\\
idle
\\
eric
'
tester('
ntpath
.
expanduser
(
"~test"
)
', '
C
:
\\
idle
\\
test
')
tester('
ntpath
.
expanduser
(
"~"
)
', '
C
:
\\
idle
\\
eric
')
tester('
ntpath
.
expanduser
(
"~test
\
\
foo
\
\
bar"
)
',
'
C
:
\\
idle
\\
test
\\
foo
\\
bar
')
'
C
:
\\
eric
\\
test
\\
foo
\\
bar
')
tester('
ntpath
.
expanduser
(
"~test/foo/bar"
)
',
'
C
:
\\
idle
\\
test
/
foo
/
bar
')
'
C
:
\\
eric
\\
test
/
foo
/
bar
')
tester('
ntpath
.
expanduser
(
"~
\
\
foo
\
\
bar"
)
',
'
C
:
\\
idle
\\
eric
\\
foo
\\
bar
')
'
C
:
\\
eric
\\
idle
\\
foo
\\
bar
')
tester('
ntpath
.
expanduser
(
"~/foo/bar"
)
',
'
C
:
\\
idle
\\
eric
/
foo
/
bar
')
'
C
:
\\
eric
\\
idle
/
foo
/
bar
')
# bpo-36264: ignore `HOME` when set on windows
env.clear()
env['
HOME
'] = '
F
:
\\
'
env['
USERPROFILE
'] = '
C
:
\\
eric
\\
idle
'
tester('
ntpath
.
expanduser
(
"~test"
)
', '
C
:
\\
eric
\\
test
')
tester('
ntpath
.
expanduser
(
"~"
)
', '
C
:
\\
eric
\\
idle
')
@unittest.skipUnless(nt, "abspath requires '
nt
' module")
def test_abspath(self):
...
...
Misc/NEWS.d/next/Windows/2019-03-11-09-33-47.bpo-36264.rTzWce.rst
0 → 100644
View file @
25ec4a45
Don't honor POSIX ``HOME`` in ``os.path.expanduser`` on windows. Patch by
Anthony Sottile.
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