Skip to content

Commit b21670f

Browse files
committed
fix missing __loader__ for bootstraped builtin modules
1 parent dc0fd95 commit b21670f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

graalpython/lib-graalpython/final_patches.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2019, 2020, 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
@@ -42,8 +42,10 @@
4242

4343
_imp.cache_all_file_modules()
4444

45-
from importlib._bootstrap import _spec_from_module
45+
from importlib._bootstrap import BuiltinImporter
4646
for name in ['importlib._bootstrap', 'importlib._bootstrap_external', '_descriptor']:
4747
mod = sys.modules.get(name, None)
4848
if mod:
49-
setattr(mod, '__spec__', _spec_from_module(mod))
49+
spec = BuiltinImporter.find_spec(name)
50+
setattr(mod, '__spec__', spec)
51+
setattr(mod, '__loader__', spec.loader)

0 commit comments

Comments
 (0)