Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,11 @@ FROZEN_FILES_IN = \
Lib/zipimport.py \
Lib/abc.py \
Lib/codecs.py \
Lib/encodings/__init__.py \
Lib/encodings/aliases.py \
Lib/encodings/ascii.py \
Lib/encodings/latin_1.py \
Lib/encodings/utf_8.py \
Lib/io.py \
Lib/_collections_abc.py \
Lib/_sitebuiltins.py \
Expand All @@ -1133,6 +1138,11 @@ FROZEN_FILES_OUT = \
Python/frozen_modules/zipimport.h \
Python/frozen_modules/abc.h \
Python/frozen_modules/codecs.h \
Python/frozen_modules/encodings.h \
Python/frozen_modules/encodings.aliases.h \
Python/frozen_modules/encodings.ascii.h \
Python/frozen_modules/encodings.latin_1.h \
Python/frozen_modules/encodings.utf_8.h \
Python/frozen_modules/io.h \
Python/frozen_modules/_collections_abc.h \
Python/frozen_modules/_sitebuiltins.h \
Expand Down Expand Up @@ -1181,6 +1191,21 @@ Python/frozen_modules/abc.h: Lib/abc.py $(FREEZE_MODULE_DEPS)
Python/frozen_modules/codecs.h: Lib/codecs.py $(FREEZE_MODULE_DEPS)
$(FREEZE_MODULE) codecs $(srcdir)/Lib/codecs.py Python/frozen_modules/codecs.h

Python/frozen_modules/encodings.h: Lib/encodings/__init__.py $(FREEZE_MODULE_DEPS)
$(FREEZE_MODULE) encodings $(srcdir)/Lib/encodings/__init__.py Python/frozen_modules/encodings.h

Python/frozen_modules/encodings.aliases.h: Lib/encodings/aliases.py $(FREEZE_MODULE_DEPS)
$(FREEZE_MODULE) encodings.aliases $(srcdir)/Lib/encodings/aliases.py Python/frozen_modules/encodings.aliases.h

Python/frozen_modules/encodings.ascii.h: Lib/encodings/ascii.py $(FREEZE_MODULE_DEPS)
$(FREEZE_MODULE) encodings.ascii $(srcdir)/Lib/encodings/ascii.py Python/frozen_modules/encodings.ascii.h

Python/frozen_modules/encodings.latin_1.h: Lib/encodings/latin_1.py $(FREEZE_MODULE_DEPS)
$(FREEZE_MODULE) encodings.latin_1 $(srcdir)/Lib/encodings/latin_1.py Python/frozen_modules/encodings.latin_1.h

Python/frozen_modules/encodings.utf_8.h: Lib/encodings/utf_8.py $(FREEZE_MODULE_DEPS)
$(FREEZE_MODULE) encodings.utf_8 $(srcdir)/Lib/encodings/utf_8.py Python/frozen_modules/encodings.utf_8.h

Python/frozen_modules/io.h: Lib/io.py $(FREEZE_MODULE_DEPS)
$(FREEZE_MODULE) io $(srcdir)/Lib/io.py Python/frozen_modules/io.h

Expand Down Expand Up @@ -1260,6 +1285,11 @@ $(DEEPFREEZE_C): $(DEEPFREEZE_DEPS)
Python/frozen_modules/zipimport.h:zipimport \
Python/frozen_modules/abc.h:abc \
Python/frozen_modules/codecs.h:codecs \
Python/frozen_modules/encodings.h:encodings \
Python/frozen_modules/encodings.aliases.h:encodings.aliases \
Python/frozen_modules/encodings.ascii.h:encodings.ascii \
Python/frozen_modules/encodings.latin_1.h:encodings.latin_1 \
Python/frozen_modules/encodings.utf_8.h:encodings.utf_8 \
Python/frozen_modules/io.h:io \
Python/frozen_modules/_collections_abc.h:_collections_abc \
Python/frozen_modules/_sitebuiltins.h:_sitebuiltins \
Expand Down
30 changes: 30 additions & 0 deletions PCbuild/_freeze_module.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,31 @@
<IntFile>$(IntDir)codecs.g.h</IntFile>
<OutFile>$(PySourcePath)Python\frozen_modules\codecs.h</OutFile>
</None>
<None Include="..\Lib\encodings\__init__.py">
<ModName>encodings</ModName>
<IntFile>$(IntDir)encodings.g.h</IntFile>
<OutFile>$(PySourcePath)Python\frozen_modules\encodings.h</OutFile>
</None>
<None Include="..\Lib\encodings\aliases.py">
<ModName>encodings.aliases</ModName>
<IntFile>$(IntDir)encodings.aliases.g.h</IntFile>
<OutFile>$(PySourcePath)Python\frozen_modules\encodings.aliases.h</OutFile>
</None>
<None Include="..\Lib\encodings\ascii.py">
<ModName>encodings.ascii</ModName>
<IntFile>$(IntDir)encodings.ascii.g.h</IntFile>
<OutFile>$(PySourcePath)Python\frozen_modules\encodings.ascii.h</OutFile>
</None>
<None Include="..\Lib\encodings\latin_1.py">
<ModName>encodings.latin_1</ModName>
<IntFile>$(IntDir)encodings.latin_1.g.h</IntFile>
<OutFile>$(PySourcePath)Python\frozen_modules\encodings.latin_1.h</OutFile>
</None>
<None Include="..\Lib\encodings\utf_8.py">
<ModName>encodings.utf_8</ModName>
<IntFile>$(IntDir)encodings.utf_8.g.h</IntFile>
<OutFile>$(PySourcePath)Python\frozen_modules\encodings.utf_8.h</OutFile>
</None>
<None Include="..\Lib\io.py">
<ModName>io</ModName>
<IntFile>$(IntDir)io.g.h</IntFile>
Expand Down Expand Up @@ -409,6 +434,11 @@
"$(PySourcePath)Python\frozen_modules\zipimport.h:zipimport" ^
"$(PySourcePath)Python\frozen_modules\abc.h:abc" ^
"$(PySourcePath)Python\frozen_modules\codecs.h:codecs" ^
"$(PySourcePath)Python\frozen_modules\encodings.h:encodings" ^
"$(PySourcePath)Python\frozen_modules\encodings.aliases.h:encodings.aliases" ^
"$(PySourcePath)Python\frozen_modules\encodings.ascii.h:encodings.ascii" ^
"$(PySourcePath)Python\frozen_modules\encodings.latin_1.h:encodings.latin_1" ^
"$(PySourcePath)Python\frozen_modules\encodings.utf_8.h:encodings.utf_8" ^
"$(PySourcePath)Python\frozen_modules\io.h:io" ^
"$(PySourcePath)Python\frozen_modules\_collections_abc.h:_collections_abc" ^
"$(PySourcePath)Python\frozen_modules\_sitebuiltins.h:_sitebuiltins" ^
Expand Down
15 changes: 15 additions & 0 deletions PCbuild/_freeze_module.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,21 @@
<None Include="..\Lib\codecs.py">
<Filter>Python Files</Filter>
</None>
<None Include="..\Lib\encodings\__init__.py">
<Filter>Python Files</Filter>
</None>
<None Include="..\Lib\encodings\aliases.py">
<Filter>Python Files</Filter>
</None>
<None Include="..\Lib\encodings\ascii.py">
<Filter>Python Files</Filter>
</None>
<None Include="..\Lib\encodings\latin_1.py">
<Filter>Python Files</Filter>
</None>
<None Include="..\Lib\encodings\utf_8.py">
<Filter>Python Files</Filter>
</None>
<None Include="..\Lib\io.py">
<Filter>Python Files</Filter>
</None>
Expand Down
15 changes: 15 additions & 0 deletions Python/frozen.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
#include "frozen_modules/zipimport.h"
#include "frozen_modules/abc.h"
#include "frozen_modules/codecs.h"
#include "frozen_modules/encodings.h"
#include "frozen_modules/encodings.aliases.h"
#include "frozen_modules/encodings.ascii.h"
#include "frozen_modules/encodings.latin_1.h"
#include "frozen_modules/encodings.utf_8.h"
#include "frozen_modules/io.h"
#include "frozen_modules/_collections_abc.h"
#include "frozen_modules/_sitebuiltins.h"
Expand Down Expand Up @@ -74,6 +79,11 @@ extern PyObject *_Py_get_importlib__bootstrap_external_toplevel(void);
extern PyObject *_Py_get_zipimport_toplevel(void);
extern PyObject *_Py_get_abc_toplevel(void);
extern PyObject *_Py_get_codecs_toplevel(void);
extern PyObject *_Py_get_encodings_toplevel(void);
extern PyObject *_Py_get_encodings_aliases_toplevel(void);
extern PyObject *_Py_get_encodings_ascii_toplevel(void);
extern PyObject *_Py_get_encodings_latin_1_toplevel(void);
extern PyObject *_Py_get_encodings_utf_8_toplevel(void);
extern PyObject *_Py_get_io_toplevel(void);
extern PyObject *_Py_get__collections_abc_toplevel(void);
extern PyObject *_Py_get__sitebuiltins_toplevel(void);
Expand Down Expand Up @@ -104,6 +114,11 @@ static const struct _frozen stdlib_modules[] = {
/* stdlib - startup, without site (python -S) */
{"abc", _Py_M__abc, (int)sizeof(_Py_M__abc), false, GET_CODE(abc)},
{"codecs", _Py_M__codecs, (int)sizeof(_Py_M__codecs), false, GET_CODE(codecs)},
{"encodings", _Py_M__encodings, (int)sizeof(_Py_M__encodings), true, GET_CODE(encodings)},
{"encodings.aliases", _Py_M__encodings_aliases, (int)sizeof(_Py_M__encodings_aliases), false, GET_CODE(encodings_aliases)},
{"encodings.ascii", _Py_M__encodings_ascii, (int)sizeof(_Py_M__encodings_ascii), false, GET_CODE(encodings_ascii)},
{"encodings.latin_1", _Py_M__encodings_latin_1, (int)sizeof(_Py_M__encodings_latin_1), false, GET_CODE(encodings_latin_1)},
{"encodings.utf_8", _Py_M__encodings_utf_8, (int)sizeof(_Py_M__encodings_utf_8), false, GET_CODE(encodings_utf_8)},
{"io", _Py_M__io, (int)sizeof(_Py_M__io), false, GET_CODE(io)},

/* stdlib - startup, with site */
Expand Down
12 changes: 8 additions & 4 deletions Tools/build/freeze_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@
('stdlib - startup, without site (python -S)', [
'abc',
'codecs',
# For now we do not freeze the encodings, due # to the noise all
# those extra modules add to the text printed during the build.
# (See https://github.com/python/cpython/pull/28398#pullrequestreview-756856469.)
#'<encodings.*>',
# Freeze the encodings package and the codecs imported during every
# interpreter start-up. This eliminates filesystem I/O that is
# prohibitively slow on Nanvix ramfs/microvm.
'<encodings>',
'encodings.aliases',
'encodings.ascii',
'encodings.latin_1',
'encodings.utf_8',
'io',
]),
('stdlib - startup, with site', [
Expand Down
Loading