From 85233df7efed7f8af777d0e9580f77809d1e812f 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 061/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 524173a..07ca7aa 100644
--- a/Lib/ntpath.py
+++ b/Lib/ntpath.py
@@ -374,7 +374,7 @@ def expanduser(path):
     if 'USERPROFILE' in os.environ:
         userhome = os.environ['USERPROFILE']
     elif 'HOMEPATH' not in os.environ:
-        return path
+        return os.path.normpath(path)
     else:
         drive = os.environ.get('HOMEDRIVE', '')
         userhome = join(drive, os.environ['HOMEPATH'])
@@ -398,7 +398,7 @@ def expanduser(path):
     if isinstance(path, bytes):
         userhome = os.fsencode(userhome)
 
-    return userhome + path[i:]
+    return os.path.normpath(userhome) + path[i:]
 
 
 # Expand paths containing shell variable substitutions.
