Skip to content

Commit 6ed5460

Browse files
committed
[GR-35173] Add support for freezing modules
PullRequest: graalpython/2119
2 parents 58880e4 + 631e48d commit 6ed5460

32 files changed

+2026
-681
lines changed

graalpython/lib-graalpython/final_patches.py renamed to graalpython/com.oracle.graal.python.frozen/flag.py

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
22
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33
#
44
# The Universal Permissive License (UPL), Version 1.0
@@ -37,25 +37,5 @@
3737
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3838
# SOFTWARE.
3939

40-
import _imp
41-
import sys
42-
43-
# - make sure encodings gets frozen in scope of _imp.cache_all_file_modules
44-
# - at this point during context startup, sys.path isn't initialized,
45-
# so we need to set it up
46-
sys.path.append(__graalpython__.stdlib_home)
47-
try:
48-
import encodings
49-
finally:
50-
assert len(sys.path) == 1
51-
sys.path.pop()
52-
53-
_imp.cache_all_file_modules()
54-
55-
from importlib._bootstrap import BuiltinImporter
56-
for name in ['importlib._bootstrap', 'importlib._bootstrap_external', '_descriptor']:
57-
mod = sys.modules.get(name, None)
58-
if mod:
59-
spec = BuiltinImporter.find_spec(name)
60-
setattr(mod, '__spec__', spec)
61-
setattr(mod, '__loader__', spec.loader)
40+
initialized = True
41+
print("Hello world!")

0 commit comments

Comments
 (0)