|
39 | 39 | #include "pycore_import.h" |
40 | 40 |
|
41 | 41 | /* Includes for frozen modules: */ |
42 | | -#include "frozen_modules/importlib._bootstrap.h" |
43 | | -#include "frozen_modules/importlib._bootstrap_external.h" |
44 | | -#include "frozen_modules/zipimport.h" |
45 | | -#include "frozen_modules/abc.h" |
46 | | -#include "frozen_modules/codecs.h" |
47 | | -#include "frozen_modules/io.h" |
48 | | -#include "frozen_modules/_collections_abc.h" |
49 | | -#include "frozen_modules/_sitebuiltins.h" |
50 | | -#include "frozen_modules/genericpath.h" |
51 | | -#include "frozen_modules/ntpath.h" |
52 | | -#include "frozen_modules/posixpath.h" |
53 | | -#include "frozen_modules/os.h" |
54 | | -#include "frozen_modules/site.h" |
55 | | -#include "frozen_modules/stat.h" |
56 | | -#include "frozen_modules/importlib.util.h" |
57 | | -#include "frozen_modules/importlib.machinery.h" |
58 | | -#include "frozen_modules/runpy.h" |
59 | | -#include "frozen_modules/__hello__.h" |
60 | | -#include "frozen_modules/__phello__.h" |
61 | | -#include "frozen_modules/__phello__.ham.h" |
62 | | -#include "frozen_modules/__phello__.ham.eggs.h" |
63 | | -#include "frozen_modules/__phello__.spam.h" |
64 | | -#include "frozen_modules/frozen_only.h" |
65 | 42 | /* End includes */ |
66 | 43 |
|
67 | 44 | #define GET_CODE(name) _Py_get_##name##_toplevel |
@@ -98,49 +75,47 @@ extern PyObject *_Py_get___phello___spam_toplevel(void); |
98 | 75 | extern PyObject *_Py_get_frozen_only_toplevel(void); |
99 | 76 | /* End extern declarations */ |
100 | 77 |
|
101 | | -/* Note that a negative size indicates a package. */ |
102 | | - |
103 | 78 | static const struct _frozen bootstrap_modules[] = { |
104 | | - {"_frozen_importlib", _Py_M__importlib__bootstrap, (int)sizeof(_Py_M__importlib__bootstrap), GET_CODE(importlib__bootstrap)}, |
105 | | - {"_frozen_importlib_external", _Py_M__importlib__bootstrap_external, (int)sizeof(_Py_M__importlib__bootstrap_external), GET_CODE(importlib__bootstrap_external)}, |
106 | | - {"zipimport", _Py_M__zipimport, (int)sizeof(_Py_M__zipimport), GET_CODE(zipimport)}, |
| 79 | + {"_frozen_importlib", NULL, 0, false, GET_CODE(importlib__bootstrap)}, |
| 80 | + {"_frozen_importlib_external", NULL, 0, false, GET_CODE(importlib__bootstrap_external)}, |
| 81 | + {"zipimport", NULL, 0, false, GET_CODE(zipimport)}, |
107 | 82 | {0, 0, 0} /* bootstrap sentinel */ |
108 | 83 | }; |
109 | 84 | static const struct _frozen stdlib_modules[] = { |
110 | 85 | /* stdlib - startup, without site (python -S) */ |
111 | | - {"abc", _Py_M__abc, (int)sizeof(_Py_M__abc), GET_CODE(abc)}, |
112 | | - {"codecs", _Py_M__codecs, (int)sizeof(_Py_M__codecs), GET_CODE(codecs)}, |
113 | | - {"io", _Py_M__io, (int)sizeof(_Py_M__io), GET_CODE(io)}, |
| 86 | + {"abc", NULL, 0, false, GET_CODE(abc)}, |
| 87 | + {"codecs", NULL, 0, false, GET_CODE(codecs)}, |
| 88 | + {"io", NULL, 0, false, GET_CODE(io)}, |
114 | 89 |
|
115 | 90 | /* stdlib - startup, with site */ |
116 | | - {"_collections_abc", _Py_M___collections_abc, (int)sizeof(_Py_M___collections_abc), GET_CODE(_collections_abc)}, |
117 | | - {"_sitebuiltins", _Py_M___sitebuiltins, (int)sizeof(_Py_M___sitebuiltins), GET_CODE(_sitebuiltins)}, |
118 | | - {"genericpath", _Py_M__genericpath, (int)sizeof(_Py_M__genericpath), GET_CODE(genericpath)}, |
119 | | - {"ntpath", _Py_M__ntpath, (int)sizeof(_Py_M__ntpath), GET_CODE(ntpath)}, |
120 | | - {"posixpath", _Py_M__posixpath, (int)sizeof(_Py_M__posixpath), GET_CODE(posixpath)}, |
121 | | - {"os.path", _Py_M__posixpath, (int)sizeof(_Py_M__posixpath), GET_CODE(posixpath)}, |
122 | | - {"os", _Py_M__os, (int)sizeof(_Py_M__os), GET_CODE(os)}, |
123 | | - {"site", _Py_M__site, (int)sizeof(_Py_M__site), GET_CODE(site)}, |
124 | | - {"stat", _Py_M__stat, (int)sizeof(_Py_M__stat), GET_CODE(stat)}, |
| 91 | + {"_collections_abc", NULL, 0, false, GET_CODE(_collections_abc)}, |
| 92 | + {"_sitebuiltins", NULL, 0, false, GET_CODE(_sitebuiltins)}, |
| 93 | + {"genericpath", NULL, 0, false, GET_CODE(genericpath)}, |
| 94 | + {"ntpath", NULL, 0, false, GET_CODE(ntpath)}, |
| 95 | + {"posixpath", NULL, 0, false, GET_CODE(posixpath)}, |
| 96 | + {"os.path", NULL, 0, false, GET_CODE(posixpath)}, |
| 97 | + {"os", NULL, 0, false, GET_CODE(os)}, |
| 98 | + {"site", NULL, 0, false, GET_CODE(site)}, |
| 99 | + {"stat", NULL, 0, false, GET_CODE(stat)}, |
125 | 100 |
|
126 | 101 | /* runpy - run module with -m */ |
127 | | - {"importlib.util", _Py_M__importlib_util, (int)sizeof(_Py_M__importlib_util), GET_CODE(importlib_util)}, |
128 | | - {"importlib.machinery", _Py_M__importlib_machinery, (int)sizeof(_Py_M__importlib_machinery), GET_CODE(importlib_machinery)}, |
129 | | - {"runpy", _Py_M__runpy, (int)sizeof(_Py_M__runpy), GET_CODE(runpy)}, |
| 102 | + {"importlib.util", NULL, 0, false, GET_CODE(importlib_util)}, |
| 103 | + {"importlib.machinery", NULL, 0, false, GET_CODE(importlib_machinery)}, |
| 104 | + {"runpy", NULL, 0, false, GET_CODE(runpy)}, |
130 | 105 | {0, 0, 0} /* stdlib sentinel */ |
131 | 106 | }; |
132 | 107 | static const struct _frozen test_modules[] = { |
133 | | - {"__hello__", _Py_M____hello__, (int)sizeof(_Py_M____hello__), GET_CODE(__hello__)}, |
134 | | - {"__hello_alias__", _Py_M____hello__, (int)sizeof(_Py_M____hello__), GET_CODE(__hello__)}, |
135 | | - {"__phello_alias__", _Py_M____hello__, -(int)sizeof(_Py_M____hello__), GET_CODE(__hello__)}, |
136 | | - {"__phello_alias__.spam", _Py_M____hello__, (int)sizeof(_Py_M____hello__), GET_CODE(__hello__)}, |
137 | | - {"__phello__", _Py_M____phello__, -(int)sizeof(_Py_M____phello__), GET_CODE(__phello__)}, |
138 | | - {"__phello__.__init__", _Py_M____phello__, (int)sizeof(_Py_M____phello__), GET_CODE(__phello__)}, |
139 | | - {"__phello__.ham", _Py_M____phello___ham, -(int)sizeof(_Py_M____phello___ham), GET_CODE(__phello___ham)}, |
140 | | - {"__phello__.ham.__init__", _Py_M____phello___ham, (int)sizeof(_Py_M____phello___ham), GET_CODE(__phello___ham)}, |
141 | | - {"__phello__.ham.eggs", _Py_M____phello___ham_eggs, (int)sizeof(_Py_M____phello___ham_eggs), GET_CODE(__phello___ham_eggs)}, |
142 | | - {"__phello__.spam", _Py_M____phello___spam, (int)sizeof(_Py_M____phello___spam), GET_CODE(__phello___spam)}, |
143 | | - {"__hello_only__", _Py_M__frozen_only, (int)sizeof(_Py_M__frozen_only), GET_CODE(frozen_only)}, |
| 108 | + {"__hello__", NULL, 0, false, GET_CODE(__hello__)}, |
| 109 | + {"__hello_alias__", NULL, 0, false, GET_CODE(__hello__)}, |
| 110 | + {"__phello_alias__", NULL, 0, true, GET_CODE(__hello__)}, |
| 111 | + {"__phello_alias__.spam", NULL, 0, false, GET_CODE(__hello__)}, |
| 112 | + {"__phello__", NULL, 0, true, GET_CODE(__phello__)}, |
| 113 | + {"__phello__.__init__", NULL, 0, false, GET_CODE(__phello__)}, |
| 114 | + {"__phello__.ham", NULL, 0, true, GET_CODE(__phello___ham)}, |
| 115 | + {"__phello__.ham.__init__", NULL, 0, false, GET_CODE(__phello___ham)}, |
| 116 | + {"__phello__.ham.eggs", NULL, 0, false, GET_CODE(__phello___ham_eggs)}, |
| 117 | + {"__phello__.spam", NULL, 0, false, GET_CODE(__phello___spam)}, |
| 118 | + {"__hello_only__", NULL, 0, false, GET_CODE(frozen_only)}, |
144 | 119 | {0, 0, 0} /* test sentinel */ |
145 | 120 | }; |
146 | 121 | const struct _frozen *_PyImport_FrozenBootstrap = bootstrap_modules; |
|
0 commit comments