@@ -59,19 +59,24 @@ class struct_frozen(Structure):
5959 items = []
6060 # _frozen_importlib changes size whenever importlib._bootstrap
6161 # changes, so it gets a special case. We should make sure it's
62- # found, but don't worry about its size too much.
63- _fzn_implib_seen = False
62+ # found, but don't worry about its size too much. The same
63+ # applies to _frozen_importlib_external.
64+ bootstrap_seen = []
65+ bootstrap_expected = (
66+ b'_frozen_importlib' ,
67+ b'_frozen_importlib_external' ,
68+ )
6469 for entry in ft :
6570 # This is dangerous. We *can* iterate over a pointer, but
6671 # the loop will not terminate (maybe with an access
6772 # violation;-) because the pointer instance has no size.
6873 if entry .name is None :
6974 break
7075
71- if entry .name == b'_frozen_importlib' :
72- _fzn_implib_seen = True
76+ if entry .name in bootstrap_expected :
77+ bootstrap_seen . append ( entry . name )
7378 self .assertTrue (entry .size ,
74- "_frozen_importlib was reported as having no size" )
79+ "{} was reported as having no size" . format ( entry . name ) )
7580 continue
7681 items .append ((entry .name , entry .size ))
7782
@@ -81,8 +86,8 @@ class struct_frozen(Structure):
8186 ]
8287 self .assertEqual (items , expected )
8388
84- self .assertTrue ( _fzn_implib_seen ,
85- "_frozen_importlib wasn't found in PyImport_FrozenModules" )
89+ self .assertEqual ( sorted ( bootstrap_seen ), bootstrap_expected ,
90+ "frozen bootstrap modules did not match PyImport_FrozenModules" )
8691
8792 from ctypes import _pointer_type_cache
8893 del _pointer_type_cache [struct_frozen ]
0 commit comments