MINGW-packages/mingw-w64-python3.13/0061-expanduser-normpath-paths-coming-from-env-vars.patch
Christoph Reiter 04c9ed3700 python3.13: Add 3.13.7
* add libb2 as dep
* remove "-Wl,--large-address-aware", default now via makepkg
* remove 2to3 logic, no longer in Python
2025-09-08 22:02:30 +02:00

33 lines
1.1 KiB
Diff

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.