blob: 894fc90c8d11c6b3486bb94ee98a3ecace1c9115 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
From 2748eca808bc4a0d9f79a86803217147fa4c69ec Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Sun, 8 Aug 2021 10:17:35 +0200
Subject: [PATCH 112/N] expanduser: normpath paths coming from env vars
This makes sure we get the same paths as with related functions in pathlib.
---
Lib/ntpath.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Lib/ntpath.py b/Lib/ntpath.py
index 77f5614..5d1c6b9 100644
--- a/Lib/ntpath.py
+++ b/Lib/ntpath.py
@@ -319,7 +319,7 @@ def expanduser(path):
if 'USERPROFILE' in os.environ:
userhome = os.environ['USERPROFILE']
elif not 'HOMEPATH' in os.environ:
- return path
+ return os.path.normpath(path)
else:
try:
drive = os.environ['HOMEDRIVE']
@@ -333,7 +333,7 @@ def expanduser(path):
if i != 1: #~user
userhome = join(dirname(userhome), path[1:i])
- return userhome + path[i:]
+ return os.path.normpath(userhome) + path[i:]
# Expand paths containing shell variable substitutions.
--
2.33.0
|