Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10beb3c

Browse files
committed
Issue #28896: Disable WindowsRegistryFinder by default.
1 parent 452b3a6 commit 10beb3c

5 files changed

Lines changed: 83 additions & 77 deletions

File tree

Lib/importlib/_bootstrap_external.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,4 @@ def _install(_bootstrap_module):
14401440
_setup(_bootstrap_module)
14411441
supported_loaders = _get_supported_file_loaders()
14421442
sys.path_hooks.extend([FileFinder.path_hook(*supported_loaders)])
1443-
if _os.__name__ == 'nt':
1444-
sys.meta_path.append(WindowsRegistryFinder)
14451443
sys.meta_path.append(PathFinder)

Misc/NEWS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Library
4242
Windows
4343
-------
4444

45-
- Issue #28896: Deprecate WindowsRegistryFinder
45+
- Issue #28896: Deprecate WindowsRegistryFinder and disable it by default.
4646

4747
Tests
4848
-----

PCbuild/_freeze_importlib.vcxproj

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,31 +76,44 @@
7676
</ProjectReference>
7777
</ItemGroup>
7878
<ItemGroup>
79-
<None Include="..\Lib\importlib\_bootstrap.py" />
79+
<None Include="..\Lib\importlib\_bootstrap.py">
80+
<IntFile>$(IntDir)importlib.g.h</IntFile>
81+
<OutFile>$(PySourcePath)Python\importlib.h</OutFile>
82+
</None>
83+
<None Include="..\Lib\importlib\_bootstrap_external.py">
84+
<IntFile>$(IntDir)importlib_external.g.h</IntFile>
85+
<OutFile>$(PySourcePath)Python\importlib_external.h</OutFile>
86+
</None>
8087
</ItemGroup>
8188
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
8289
<ImportGroup Label="ExtensionTargets">
8390
</ImportGroup>
84-
<Target Name="RebuildImportLib" AfterTargets="AfterBuild" Condition="$(Configuration) == 'Debug' or $(Configuration) == 'Release'">
85-
<Exec Command='"$(TargetPath)" "$(PySourcePath)Lib\importlib\_bootstrap.py" "$(IntDir)importlib.g.h"' />
91+
<Target Name="_RebuildImportLib">
92+
<Exec Command='"$(TargetPath)" "%(None.FullPath)" "%(None.IntFile)"' />
8693

8794
<PropertyGroup>
88-
<_OldContent Condition="Exists('$(PySourcePath)Python\importlib.h')">$([System.IO.File]::ReadAllText('$(PySourcePath)Python\importlib.h').Replace(`&#x0D;&#x0A;`, `&#x0A;`))</_OldContent>
89-
<_NewContent Condition="Exists('$(IntDir)importlib.g.h')">$([System.IO.File]::ReadAllText('$(IntDir)importlib.g.h').Replace(`&#x0D;&#x0A;`, `&#x0A;`))</_NewContent>
95+
<_OldContent Condition="Exists($(OutTargetPath))"></_OldContent>
96+
<_NewContent Condition="Exists($(IntTargetPath))">$([System.IO.File]::ReadAllText($(IntTargetPath)).Replace(`&#x0D;&#x0A;`, `&#x0A;`))</_NewContent>
9097
</PropertyGroup>
9198

92-
<Copy SourceFiles="$(IntDir)importlib.g.h"
93-
DestinationFiles="$(PySourcePath)Python\importlib.h"
94-
Condition="Exists('$(IntDir)importlib.g.h') and '$(_OldContent)' != '$(_NewContent)'" />
99+
<Copy SourceFiles="%(None.IntFile)"
100+
DestinationFiles="%(None.OutFile)"
101+
Condition="!Exists(%(None.OutFile)) or (Exists(%(None.IntFile)) and '$([System.IO.File]::ReadAllText(%(None.OutFile)).Replace(`&#x0D;&#x0A;`, `&#x0A;`))' != '$([System.IO.File]::ReadAllText(%(None.IntFile)).Replace(`&#x0D;&#x0A;`, `&#x0A;`))')">
102+
<Output TaskParameter="CopiedFiles" ItemName="_Updated" />
103+
</Copy>
95104

96-
<Warning Text="importlib.h has been updated. You will need to rebuild pythoncore to see the changes."
97-
Condition="Exists('$(IntDir)importlib.g.h') and '$(_OldContent)' != '$(_NewContent)' and $(Configuration) == 'Debug'" />
98-
<Error Text="importlib.h has been updated. You will need to rebuild pythoncore to see the changes."
99-
Condition="Exists('$(IntDir)importlib.g.h') and '$(_OldContent)' != '$(_NewContent)' and $(Configuration) == 'Release'" />
105+
<Warning Text="@(_Updated->'%(Filename)%(Extension)',', ') updated. You will need to rebuild pythoncore to see the changes."
106+
Condition="'@(_Updated)' != '' and $(Configuration) == 'Debug'" />
107+
<Error Text="@(_Updated->'%(Filename)%(Extension)',', ') updated. You will need to rebuild pythoncore to see the changes."
108+
Condition="'@(_Updated)' != '' and $(Configuration) == 'Release'" />
109+
</Target>
110+
<Target Name="RebuildImportLib" AfterTargets="AfterBuild" Condition="$(Configuration) == 'Debug' or $(Configuration) == 'Release'"
111+
DependsOnTargets="_RebuildImportLib">
100112
</Target>
101113
<Target Name="_CleanImportLib" BeforeTargets="CoreClean">
102114
<ItemGroup>
103115
<Clean Include="$(IntDir)importlib.g.h" />
116+
<Clean Include="$(IntDir)importlib_external.g.h" />
104117
</ItemGroup>
105118
</Target>
106119
</Project>

PCbuild/pcbuild.proj

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<BuildTarget>Build</BuildTarget>
2929
<CleanTarget>Clean</CleanTarget>
3030
<CleanAllTarget>CleanAll</CleanAllTarget>
31-
<BuildInParallel>true</BuildInParallel>
31+
<BuildInParallel>false</BuildInParallel>
3232
</Projects2>
3333
</ItemDefinitionGroup>
3434
<ItemGroup>
@@ -48,8 +48,6 @@
4848
<Projects Include="pylauncher.vcxproj;pywlauncher.vcxproj" />
4949
<!-- pyshellext.dll -->
5050
<Projects Include="pyshellext.vcxproj" />
51-
<!-- _freeze_importlib -->
52-
<Projects Include="_freeze_importlib.vcxproj" />
5351
<!-- Extension modules -->
5452
<ExtensionModules Include="_asyncio;_ctypes;_decimal;_elementtree;_msi;_multiprocessing;_overlapped;pyexpat;select;unicodedata;winsound" />
5553
<!-- Extension modules that require external sources -->
@@ -68,10 +66,10 @@
6866
<BuildInParallel>false</BuildInParallel>
6967
</Projects>
7068

69+
<!-- _freeze_importlib -->
70+
<Projects2 Include="_freeze_importlib.vcxproj" />
7171
<!-- python[w].exe -->
72-
<Projects2 Include="python.vcxproj;pythonw.vcxproj">
73-
<BuildInParallel>false</BuildInParallel>
74-
</Projects2>
72+
<Projects2 Include="python.vcxproj;pythonw.vcxproj" />
7573
</ItemGroup>
7674

7775
<Target Name="Build">

Python/importlib_external.h

Lines changed: 53 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,7 +2334,7 @@ const unsigned char _Py_M__importlib_external[] = {
23342334
111,111,116,115,116,114,97,112,32,109,111,100,117,108,101,46,
23352335
10,10,32,32,32,32,114,52,0,0,0,114,63,0,0,0,
23362336
218,8,98,117,105,108,116,105,110,115,114,140,0,0,0,90,
2337-
5,112,111,115,105,120,250,1,47,218,2,110,116,250,1,92,
2337+
5,112,111,115,105,120,250,1,47,90,2,110,116,250,1,92,
23382338
99,1,0,0,0,0,0,0,0,2,0,0,0,3,0,0,
23392339
0,115,0,0,0,115,26,0,0,0,124,0,93,18,125,1,
23402340
116,0,124,1,131,1,100,0,107,2,86,0,1,0,113,2,
@@ -2376,61 +2376,58 @@ const unsigned char _Py_M__importlib_external[] = {
23762376
1,10,1,4,2,2,1,10,1,6,1,14,1,12,2,8,
23772377
1,12,1,12,1,18,3,2,1,14,1,16,2,10,1,12,
23782378
3,10,1,12,3,10,1,10,1,12,3,14,1,14,1,10,
2379-
1,10,1,10,1,114,32,1,0,0,99,1,0,0,0,0,
2379+
1,10,1,10,1,114,31,1,0,0,99,1,0,0,0,0,
23802380
0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,115,
2381-
72,0,0,0,116,0,124,0,131,1,1,0,116,1,131,0,
2381+
50,0,0,0,116,0,124,0,131,1,1,0,116,1,131,0,
23822382
125,1,116,2,106,3,106,4,116,5,106,6,124,1,142,0,
2383-
103,1,131,1,1,0,116,7,106,8,100,1,107,2,114,56,
2384-
116,2,106,9,106,10,116,11,131,1,1,0,116,2,106,9,
2385-
106,10,116,12,131,1,1,0,100,2,83,0,41,3,122,41,
2386-
73,110,115,116,97,108,108,32,116,104,101,32,112,97,116,104,
2387-
45,98,97,115,101,100,32,105,109,112,111,114,116,32,99,111,
2388-
109,112,111,110,101,110,116,115,46,114,27,1,0,0,78,41,
2389-
13,114,32,1,0,0,114,159,0,0,0,114,8,0,0,0,
2390-
114,253,0,0,0,114,147,0,0,0,114,5,1,0,0,114,
2391-
18,1,0,0,114,3,0,0,0,114,109,0,0,0,218,9,
2392-
109,101,116,97,95,112,97,116,104,114,161,0,0,0,114,166,
2393-
0,0,0,114,248,0,0,0,41,2,114,31,1,0,0,90,
2394-
17,115,117,112,112,111,114,116,101,100,95,108,111,97,100,101,
2395-
114,115,114,4,0,0,0,114,4,0,0,0,114,6,0,0,
2396-
0,218,8,95,105,110,115,116,97,108,108,158,5,0,0,115,
2397-
12,0,0,0,0,2,8,1,6,1,20,1,10,1,12,1,
2398-
114,34,1,0,0,41,1,114,0,0,0,0,41,2,114,1,
2399-
0,0,0,114,2,0,0,0,41,1,114,49,0,0,0,41,
2400-
1,78,41,3,78,78,78,41,3,78,78,78,41,2,114,62,
2401-
0,0,0,114,62,0,0,0,41,1,78,41,1,78,41,58,
2402-
114,111,0,0,0,114,12,0,0,0,90,37,95,67,65,83,
2403-
69,95,73,78,83,69,78,83,73,84,73,86,69,95,80,76,
2404-
65,84,70,79,82,77,83,95,66,89,84,69,83,95,75,69,
2405-
89,114,11,0,0,0,114,13,0,0,0,114,19,0,0,0,
2406-
114,21,0,0,0,114,30,0,0,0,114,40,0,0,0,114,
2407-
41,0,0,0,114,45,0,0,0,114,46,0,0,0,114,48,
2408-
0,0,0,114,58,0,0,0,218,4,116,121,112,101,218,8,
2409-
95,95,99,111,100,101,95,95,114,142,0,0,0,114,17,0,
2410-
0,0,114,132,0,0,0,114,16,0,0,0,114,20,0,0,
2411-
0,90,17,95,82,65,87,95,77,65,71,73,67,95,78,85,
2412-
77,66,69,82,114,77,0,0,0,114,76,0,0,0,114,88,
2413-
0,0,0,114,78,0,0,0,90,23,68,69,66,85,71,95,
2414-
66,89,84,69,67,79,68,69,95,83,85,70,70,73,88,69,
2415-
83,90,27,79,80,84,73,77,73,90,69,68,95,66,89,84,
2416-
69,67,79,68,69,95,83,85,70,70,73,88,69,83,114,83,
2417-
0,0,0,114,89,0,0,0,114,95,0,0,0,114,99,0,
2418-
0,0,114,101,0,0,0,114,120,0,0,0,114,127,0,0,
2419-
0,114,139,0,0,0,114,145,0,0,0,114,148,0,0,0,
2420-
114,153,0,0,0,218,6,111,98,106,101,99,116,114,160,0,
2421-
0,0,114,165,0,0,0,114,166,0,0,0,114,181,0,0,
2422-
0,114,191,0,0,0,114,207,0,0,0,114,215,0,0,0,
2423-
114,220,0,0,0,114,226,0,0,0,114,221,0,0,0,114,
2424-
227,0,0,0,114,246,0,0,0,114,248,0,0,0,114,5,
2425-
1,0,0,114,23,1,0,0,114,159,0,0,0,114,32,1,
2426-
0,0,114,34,1,0,0,114,4,0,0,0,114,4,0,0,
2427-
0,114,4,0,0,0,114,6,0,0,0,218,8,60,109,111,
2428-
100,117,108,101,62,8,0,0,0,115,108,0,0,0,4,16,
2429-
4,1,4,1,2,1,6,3,8,17,8,5,8,5,8,6,
2430-
8,12,8,10,8,9,8,5,8,7,10,22,10,123,16,1,
2431-
12,2,4,1,4,2,6,2,6,2,8,2,16,45,8,34,
2432-
8,19,8,12,8,12,8,28,8,17,10,55,10,12,10,10,
2433-
8,14,6,3,4,1,14,67,14,64,14,29,16,110,14,41,
2434-
18,45,18,16,4,3,18,53,14,60,14,42,14,127,0,5,
2435-
14,127,0,22,10,23,8,11,8,68,
2383+
103,1,131,1,1,0,116,2,106,7,106,8,116,9,131,1,
2384+
1,0,100,1,83,0,41,2,122,41,73,110,115,116,97,108,
2385+
108,32,116,104,101,32,112,97,116,104,45,98,97,115,101,100,
2386+
32,105,109,112,111,114,116,32,99,111,109,112,111,110,101,110,
2387+
116,115,46,78,41,10,114,31,1,0,0,114,159,0,0,0,
2388+
114,8,0,0,0,114,253,0,0,0,114,147,0,0,0,114,
2389+
5,1,0,0,114,18,1,0,0,218,9,109,101,116,97,95,
2390+
112,97,116,104,114,161,0,0,0,114,248,0,0,0,41,2,
2391+
114,30,1,0,0,90,17,115,117,112,112,111,114,116,101,100,
2392+
95,108,111,97,100,101,114,115,114,4,0,0,0,114,4,0,
2393+
0,0,114,6,0,0,0,218,8,95,105,110,115,116,97,108,
2394+
108,158,5,0,0,115,8,0,0,0,0,2,8,1,6,1,
2395+
20,1,114,33,1,0,0,41,1,114,0,0,0,0,41,2,
2396+
114,1,0,0,0,114,2,0,0,0,41,1,114,49,0,0,
2397+
0,41,1,78,41,3,78,78,78,41,3,78,78,78,41,2,
2398+
114,62,0,0,0,114,62,0,0,0,41,1,78,41,1,78,
2399+
41,58,114,111,0,0,0,114,12,0,0,0,90,37,95,67,
2400+
65,83,69,95,73,78,83,69,78,83,73,84,73,86,69,95,
2401+
80,76,65,84,70,79,82,77,83,95,66,89,84,69,83,95,
2402+
75,69,89,114,11,0,0,0,114,13,0,0,0,114,19,0,
2403+
0,0,114,21,0,0,0,114,30,0,0,0,114,40,0,0,
2404+
0,114,41,0,0,0,114,45,0,0,0,114,46,0,0,0,
2405+
114,48,0,0,0,114,58,0,0,0,218,4,116,121,112,101,
2406+
218,8,95,95,99,111,100,101,95,95,114,142,0,0,0,114,
2407+
17,0,0,0,114,132,0,0,0,114,16,0,0,0,114,20,
2408+
0,0,0,90,17,95,82,65,87,95,77,65,71,73,67,95,
2409+
78,85,77,66,69,82,114,77,0,0,0,114,76,0,0,0,
2410+
114,88,0,0,0,114,78,0,0,0,90,23,68,69,66,85,
2411+
71,95,66,89,84,69,67,79,68,69,95,83,85,70,70,73,
2412+
88,69,83,90,27,79,80,84,73,77,73,90,69,68,95,66,
2413+
89,84,69,67,79,68,69,95,83,85,70,70,73,88,69,83,
2414+
114,83,0,0,0,114,89,0,0,0,114,95,0,0,0,114,
2415+
99,0,0,0,114,101,0,0,0,114,120,0,0,0,114,127,
2416+
0,0,0,114,139,0,0,0,114,145,0,0,0,114,148,0,
2417+
0,0,114,153,0,0,0,218,6,111,98,106,101,99,116,114,
2418+
160,0,0,0,114,165,0,0,0,114,166,0,0,0,114,181,
2419+
0,0,0,114,191,0,0,0,114,207,0,0,0,114,215,0,
2420+
0,0,114,220,0,0,0,114,226,0,0,0,114,221,0,0,
2421+
0,114,227,0,0,0,114,246,0,0,0,114,248,0,0,0,
2422+
114,5,1,0,0,114,23,1,0,0,114,159,0,0,0,114,
2423+
31,1,0,0,114,33,1,0,0,114,4,0,0,0,114,4,
2424+
0,0,0,114,4,0,0,0,114,6,0,0,0,218,8,60,
2425+
109,111,100,117,108,101,62,8,0,0,0,115,108,0,0,0,
2426+
4,16,4,1,4,1,2,1,6,3,8,17,8,5,8,5,
2427+
8,6,8,12,8,10,8,9,8,5,8,7,10,22,10,123,
2428+
16,1,12,2,4,1,4,2,6,2,6,2,8,2,16,45,
2429+
8,34,8,19,8,12,8,12,8,28,8,17,10,55,10,12,
2430+
10,10,8,14,6,3,4,1,14,67,14,64,14,29,16,110,
2431+
14,41,18,45,18,16,4,3,18,53,14,60,14,42,14,127,
2432+
0,5,14,127,0,22,10,23,8,11,8,68,
24362433
};

0 commit comments

Comments
 (0)