Skip to content

Commit a4774f4

Browse files
authored
bpo-45720: Drop references to shlwapi.dll on Windows (GH-29417)
1 parent 4d8f2e0 commit a4774f4

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Internal reference to :file:`shlwapi.dll` was dropped to help improve
2+
startup time. This DLL will no longer be loaded at the start of every Python
3+
process.

PC/getpathp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@
9292

9393
#include <windows.h>
9494
#include <pathcch.h>
95-
#include <shlwapi.h>
9695

9796
#ifdef HAVE_SYS_TYPES_H
9897
#include <sys/types.h>
@@ -265,7 +264,8 @@ canonicalize(wchar_t *buffer, const wchar_t *path)
265264
return _PyStatus_NO_MEMORY();
266265
}
267266

268-
if (PathIsRelativeW(path)) {
267+
const wchar_t *pathTail;
268+
if (FAILED(PathCchSkipRoot(path, &pathTail)) || path == pathTail) {
269269
wchar_t buff[MAXPATHLEN + 1];
270270
if (!GetCurrentDirectoryW(MAXPATHLEN, buff)) {
271271
return _PyStatus_ERR("unable to find current working directory");

PCbuild/_freeze_module.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
</ClCompile>
9393
<Link>
9494
<SubSystem>Console</SubSystem>
95-
<AdditionalDependencies>version.lib;shlwapi.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
95+
<AdditionalDependencies>version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
9696
</Link>
9797
</ItemDefinitionGroup>
9898
<ItemGroup>

PCbuild/pythoncore.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
<PreprocessorDefinitions Condition="$(IncludeExternals)">_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
107107
</ClCompile>
108108
<Link>
109-
<AdditionalDependencies>version.lib;shlwapi.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
109+
<AdditionalDependencies>version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
110110
</Link>
111111
</ItemDefinitionGroup>
112112
<ItemGroup>

0 commit comments

Comments
 (0)