]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45720: Drop references to shlwapi.dll on Windows (GH-29417)
authorSteve Dower <steve.dower@python.org>
Fri, 5 Nov 2021 23:06:45 +0000 (23:06 +0000)
committerGitHub <noreply@github.com>
Fri, 5 Nov 2021 23:06:45 +0000 (23:06 +0000)
Misc/NEWS.d/next/Windows/2021-11-05-01-05-46.bpo-45720.47Nc5I.rst [new file with mode: 0644]
PC/getpathp.c
PCbuild/_freeze_module.vcxproj
PCbuild/pythoncore.vcxproj

diff --git a/Misc/NEWS.d/next/Windows/2021-11-05-01-05-46.bpo-45720.47Nc5I.rst b/Misc/NEWS.d/next/Windows/2021-11-05-01-05-46.bpo-45720.47Nc5I.rst
new file mode 100644 (file)
index 0000000..315759b
--- /dev/null
@@ -0,0 +1,3 @@
+Internal reference to :file:`shlwapi.dll` was dropped to help improve
+startup time. This DLL will no longer be loaded at the start of every Python
+process.
index 549353d78b116ac64e5a6695a399d0dc2d85741a..a27348024d25277b708b629976136014d365bd8b 100644 (file)
@@ -92,7 +92,6 @@
 
 #include <windows.h>
 #include <pathcch.h>
-#include <shlwapi.h>
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -265,7 +264,8 @@ canonicalize(wchar_t *buffer, const wchar_t *path)
         return _PyStatus_NO_MEMORY();
     }
 
-    if (PathIsRelativeW(path)) {
+    const wchar_t *pathTail;
+    if (FAILED(PathCchSkipRoot(path, &pathTail)) || path == pathTail) {
         wchar_t buff[MAXPATHLEN + 1];
         if (!GetCurrentDirectoryW(MAXPATHLEN, buff)) {
             return _PyStatus_ERR("unable to find current working directory");
index 12bdde2af84d9aeb65585896c6c40e581fe59a2e..d33e07c54b8c9c12a7add81fdd12100978613d78 100644 (file)
@@ -92,7 +92,7 @@
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>
-      <AdditionalDependencies>version.lib;shlwapi.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
index 646bc8e4800b1257d5d18ce89ec08023b23bc651..b65998186927b6bc5551cf26f7db53c7d2d79493 100644 (file)
       <PreprocessorDefinitions Condition="$(IncludeExternals)">_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <Link>
-      <AdditionalDependencies>version.lib;shlwapi.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>