From 10beb3cfef97d162b49b95c538c69c17a20bc910 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Mon, 12 Dec 2016 11:17:59 -0800 Subject: [PATCH] Issue #28896: Disable WindowsRegistryFinder by default. --- Lib/importlib/_bootstrap_external.py | 2 - Misc/NEWS | 2 +- PCbuild/_freeze_importlib.vcxproj | 37 ++++++--- PCbuild/pcbuild.proj | 10 +-- Python/importlib_external.h | 109 +++++++++++++-------------- 5 files changed, 83 insertions(+), 77 deletions(-) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index ab434460c26..9feec50842c 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -1440,6 +1440,4 @@ def _install(_bootstrap_module): _setup(_bootstrap_module) supported_loaders = _get_supported_file_loaders() sys.path_hooks.extend([FileFinder.path_hook(*supported_loaders)]) - if _os.__name__ == 'nt': - sys.meta_path.append(WindowsRegistryFinder) sys.meta_path.append(PathFinder) diff --git a/Misc/NEWS b/Misc/NEWS index 446b9f937e2..f4433daf803 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -42,7 +42,7 @@ Library Windows ------- -- Issue #28896: Deprecate WindowsRegistryFinder +- Issue #28896: Deprecate WindowsRegistryFinder and disable it by default. Tests ----- diff --git a/PCbuild/_freeze_importlib.vcxproj b/PCbuild/_freeze_importlib.vcxproj index f7714c003af..c73266301e8 100644 --- a/PCbuild/_freeze_importlib.vcxproj +++ b/PCbuild/_freeze_importlib.vcxproj @@ -76,31 +76,44 @@ - + + $(IntDir)importlib.g.h + $(PySourcePath)Python\importlib.h + + + $(IntDir)importlib_external.g.h + $(PySourcePath)Python\importlib_external.h + - - + + - <_OldContent Condition="Exists('$(PySourcePath)Python\importlib.h')">$([System.IO.File]::ReadAllText('$(PySourcePath)Python\importlib.h').Replace(` `, ` `)) - <_NewContent Condition="Exists('$(IntDir)importlib.g.h')">$([System.IO.File]::ReadAllText('$(IntDir)importlib.g.h').Replace(` `, ` `)) + <_OldContent Condition="Exists($(OutTargetPath))"> + <_NewContent Condition="Exists($(IntTargetPath))">$([System.IO.File]::ReadAllText($(IntTargetPath)).Replace(` `, ` `)) - + + + - - + + + + + diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj index e0e6e93fc0a..c6b8487c0a2 100644 --- a/PCbuild/pcbuild.proj +++ b/PCbuild/pcbuild.proj @@ -28,7 +28,7 @@ Build Clean CleanAll - true + false @@ -48,8 +48,6 @@ - - @@ -68,10 +66,10 @@ false + + - - false - + diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 1b767c5a9ba..2f40978fb78 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -2334,7 +2334,7 @@ const unsigned char _Py_M__importlib_external[] = { 111,111,116,115,116,114,97,112,32,109,111,100,117,108,101,46, 10,10,32,32,32,32,114,52,0,0,0,114,63,0,0,0, 218,8,98,117,105,108,116,105,110,115,114,140,0,0,0,90, - 5,112,111,115,105,120,250,1,47,218,2,110,116,250,1,92, + 5,112,111,115,105,120,250,1,47,90,2,110,116,250,1,92, 99,1,0,0,0,0,0,0,0,2,0,0,0,3,0,0, 0,115,0,0,0,115,26,0,0,0,124,0,93,18,125,1, 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[] = { 1,10,1,4,2,2,1,10,1,6,1,14,1,12,2,8, 1,12,1,12,1,18,3,2,1,14,1,16,2,10,1,12, 3,10,1,12,3,10,1,10,1,12,3,14,1,14,1,10, - 1,10,1,10,1,114,32,1,0,0,99,1,0,0,0,0, + 1,10,1,10,1,114,31,1,0,0,99,1,0,0,0,0, 0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,115, - 72,0,0,0,116,0,124,0,131,1,1,0,116,1,131,0, + 50,0,0,0,116,0,124,0,131,1,1,0,116,1,131,0, 125,1,116,2,106,3,106,4,116,5,106,6,124,1,142,0, - 103,1,131,1,1,0,116,7,106,8,100,1,107,2,114,56, - 116,2,106,9,106,10,116,11,131,1,1,0,116,2,106,9, - 106,10,116,12,131,1,1,0,100,2,83,0,41,3,122,41, - 73,110,115,116,97,108,108,32,116,104,101,32,112,97,116,104, - 45,98,97,115,101,100,32,105,109,112,111,114,116,32,99,111, - 109,112,111,110,101,110,116,115,46,114,27,1,0,0,78,41, - 13,114,32,1,0,0,114,159,0,0,0,114,8,0,0,0, - 114,253,0,0,0,114,147,0,0,0,114,5,1,0,0,114, - 18,1,0,0,114,3,0,0,0,114,109,0,0,0,218,9, - 109,101,116,97,95,112,97,116,104,114,161,0,0,0,114,166, - 0,0,0,114,248,0,0,0,41,2,114,31,1,0,0,90, - 17,115,117,112,112,111,114,116,101,100,95,108,111,97,100,101, - 114,115,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,218,8,95,105,110,115,116,97,108,108,158,5,0,0,115, - 12,0,0,0,0,2,8,1,6,1,20,1,10,1,12,1, - 114,34,1,0,0,41,1,114,0,0,0,0,41,2,114,1, - 0,0,0,114,2,0,0,0,41,1,114,49,0,0,0,41, - 1,78,41,3,78,78,78,41,3,78,78,78,41,2,114,62, - 0,0,0,114,62,0,0,0,41,1,78,41,1,78,41,58, - 114,111,0,0,0,114,12,0,0,0,90,37,95,67,65,83, - 69,95,73,78,83,69,78,83,73,84,73,86,69,95,80,76, - 65,84,70,79,82,77,83,95,66,89,84,69,83,95,75,69, - 89,114,11,0,0,0,114,13,0,0,0,114,19,0,0,0, - 114,21,0,0,0,114,30,0,0,0,114,40,0,0,0,114, - 41,0,0,0,114,45,0,0,0,114,46,0,0,0,114,48, - 0,0,0,114,58,0,0,0,218,4,116,121,112,101,218,8, - 95,95,99,111,100,101,95,95,114,142,0,0,0,114,17,0, - 0,0,114,132,0,0,0,114,16,0,0,0,114,20,0,0, - 0,90,17,95,82,65,87,95,77,65,71,73,67,95,78,85, - 77,66,69,82,114,77,0,0,0,114,76,0,0,0,114,88, - 0,0,0,114,78,0,0,0,90,23,68,69,66,85,71,95, - 66,89,84,69,67,79,68,69,95,83,85,70,70,73,88,69, - 83,90,27,79,80,84,73,77,73,90,69,68,95,66,89,84, - 69,67,79,68,69,95,83,85,70,70,73,88,69,83,114,83, - 0,0,0,114,89,0,0,0,114,95,0,0,0,114,99,0, - 0,0,114,101,0,0,0,114,120,0,0,0,114,127,0,0, - 0,114,139,0,0,0,114,145,0,0,0,114,148,0,0,0, - 114,153,0,0,0,218,6,111,98,106,101,99,116,114,160,0, - 0,0,114,165,0,0,0,114,166,0,0,0,114,181,0,0, - 0,114,191,0,0,0,114,207,0,0,0,114,215,0,0,0, - 114,220,0,0,0,114,226,0,0,0,114,221,0,0,0,114, - 227,0,0,0,114,246,0,0,0,114,248,0,0,0,114,5, - 1,0,0,114,23,1,0,0,114,159,0,0,0,114,32,1, - 0,0,114,34,1,0,0,114,4,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,6,0,0,0,218,8,60,109,111, - 100,117,108,101,62,8,0,0,0,115,108,0,0,0,4,16, - 4,1,4,1,2,1,6,3,8,17,8,5,8,5,8,6, - 8,12,8,10,8,9,8,5,8,7,10,22,10,123,16,1, - 12,2,4,1,4,2,6,2,6,2,8,2,16,45,8,34, - 8,19,8,12,8,12,8,28,8,17,10,55,10,12,10,10, - 8,14,6,3,4,1,14,67,14,64,14,29,16,110,14,41, - 18,45,18,16,4,3,18,53,14,60,14,42,14,127,0,5, - 14,127,0,22,10,23,8,11,8,68, + 103,1,131,1,1,0,116,2,106,7,106,8,116,9,131,1, + 1,0,100,1,83,0,41,2,122,41,73,110,115,116,97,108, + 108,32,116,104,101,32,112,97,116,104,45,98,97,115,101,100, + 32,105,109,112,111,114,116,32,99,111,109,112,111,110,101,110, + 116,115,46,78,41,10,114,31,1,0,0,114,159,0,0,0, + 114,8,0,0,0,114,253,0,0,0,114,147,0,0,0,114, + 5,1,0,0,114,18,1,0,0,218,9,109,101,116,97,95, + 112,97,116,104,114,161,0,0,0,114,248,0,0,0,41,2, + 114,30,1,0,0,90,17,115,117,112,112,111,114,116,101,100, + 95,108,111,97,100,101,114,115,114,4,0,0,0,114,4,0, + 0,0,114,6,0,0,0,218,8,95,105,110,115,116,97,108, + 108,158,5,0,0,115,8,0,0,0,0,2,8,1,6,1, + 20,1,114,33,1,0,0,41,1,114,0,0,0,0,41,2, + 114,1,0,0,0,114,2,0,0,0,41,1,114,49,0,0, + 0,41,1,78,41,3,78,78,78,41,3,78,78,78,41,2, + 114,62,0,0,0,114,62,0,0,0,41,1,78,41,1,78, + 41,58,114,111,0,0,0,114,12,0,0,0,90,37,95,67, + 65,83,69,95,73,78,83,69,78,83,73,84,73,86,69,95, + 80,76,65,84,70,79,82,77,83,95,66,89,84,69,83,95, + 75,69,89,114,11,0,0,0,114,13,0,0,0,114,19,0, + 0,0,114,21,0,0,0,114,30,0,0,0,114,40,0,0, + 0,114,41,0,0,0,114,45,0,0,0,114,46,0,0,0, + 114,48,0,0,0,114,58,0,0,0,218,4,116,121,112,101, + 218,8,95,95,99,111,100,101,95,95,114,142,0,0,0,114, + 17,0,0,0,114,132,0,0,0,114,16,0,0,0,114,20, + 0,0,0,90,17,95,82,65,87,95,77,65,71,73,67,95, + 78,85,77,66,69,82,114,77,0,0,0,114,76,0,0,0, + 114,88,0,0,0,114,78,0,0,0,90,23,68,69,66,85, + 71,95,66,89,84,69,67,79,68,69,95,83,85,70,70,73, + 88,69,83,90,27,79,80,84,73,77,73,90,69,68,95,66, + 89,84,69,67,79,68,69,95,83,85,70,70,73,88,69,83, + 114,83,0,0,0,114,89,0,0,0,114,95,0,0,0,114, + 99,0,0,0,114,101,0,0,0,114,120,0,0,0,114,127, + 0,0,0,114,139,0,0,0,114,145,0,0,0,114,148,0, + 0,0,114,153,0,0,0,218,6,111,98,106,101,99,116,114, + 160,0,0,0,114,165,0,0,0,114,166,0,0,0,114,181, + 0,0,0,114,191,0,0,0,114,207,0,0,0,114,215,0, + 0,0,114,220,0,0,0,114,226,0,0,0,114,221,0,0, + 0,114,227,0,0,0,114,246,0,0,0,114,248,0,0,0, + 114,5,1,0,0,114,23,1,0,0,114,159,0,0,0,114, + 31,1,0,0,114,33,1,0,0,114,4,0,0,0,114,4, + 0,0,0,114,4,0,0,0,114,6,0,0,0,218,8,60, + 109,111,100,117,108,101,62,8,0,0,0,115,108,0,0,0, + 4,16,4,1,4,1,2,1,6,3,8,17,8,5,8,5, + 8,6,8,12,8,10,8,9,8,5,8,7,10,22,10,123, + 16,1,12,2,4,1,4,2,6,2,6,2,8,2,16,45, + 8,34,8,19,8,12,8,12,8,28,8,17,10,55,10,12, + 10,10,8,14,6,3,4,1,14,67,14,64,14,29,16,110, + 14,41,18,45,18,16,4,3,18,53,14,60,14,42,14,127, + 0,5,14,127,0,22,10,23,8,11,8,68, };