Skip to content

Commit 04ec8a1

Browse files
committed
Avoid _call_with_frames_removed
1 parent ee36da4 commit 04ec8a1

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

graalpython/lib-python/3/importlib/_bootstrap.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -992,12 +992,14 @@ def create_module(spec):
992992
if spec.name not in sys.builtin_module_names:
993993
raise ImportError(f'{spec.name!r} is not a built-in module',
994994
name=spec.name)
995-
return _call_with_frames_removed(_imp.create_builtin, spec)
995+
# GraalPy change: we don't need _call_with_frames_removed
996+
return _imp.create_builtin(spec)
996997

997998
@staticmethod
998999
def exec_module(module):
9991000
"""Exec a built-in module"""
1000-
_call_with_frames_removed(_imp.exec_builtin, module)
1001+
# GraalPy change: we don't need _call_with_frames_removed
1002+
_imp.exec_builtin(module)
10011003

10021004
@classmethod
10031005
@_requires_builtin
@@ -1127,7 +1129,8 @@ def _resolve_filename(cls, fullname, alias=None, ispkg=False):
11271129

11281130
@classmethod
11291131
def find_spec(cls, fullname, path=None, target=None):
1130-
info = _call_with_frames_removed(_imp.find_frozen, fullname)
1132+
# GraalPy change: we don't need _call_with_frames_removed
1133+
info = _imp.find_frozen(fullname)
11311134
if info is None:
11321135
return None
11331136
# We get the marshaled data in exec_module() (the loader
@@ -1172,7 +1175,8 @@ def create_module(spec):
11721175
def exec_module(module):
11731176
spec = module.__spec__
11741177
name = spec.name
1175-
code = _call_with_frames_removed(_imp.get_frozen_object, name)
1178+
# GraalPy change: we don't need _call_with_frames_removed
1179+
code = _imp.get_frozen_object(name)
11761180
exec(code, module.__dict__)
11771181

11781182
@classmethod
@@ -1307,7 +1311,8 @@ def _find_and_load_unlocked(name, import_):
13071311
parent_spec = None
13081312
if parent:
13091313
if parent not in sys.modules:
1310-
_call_with_frames_removed(import_, parent)
1314+
# GraalPy change: we don't need _call_with_frames_removed
1315+
import_(parent)
13111316
# Crazy side-effects!
13121317
if name in sys.modules:
13131318
return sys.modules[name]
@@ -1412,7 +1417,8 @@ def _handle_fromlist(module, fromlist, import_, *, recursive=False):
14121417
elif not hasattr(module, x):
14131418
from_name = f'{module.__name__}.{x}'
14141419
try:
1415-
_call_with_frames_removed(import_, from_name)
1420+
# GraalPy change: we don't need _call_with_frames_removed
1421+
import_(from_name)
14161422
except ModuleNotFoundError as exc:
14171423
# Backwards-compatibility dictates we ignore failed
14181424
# imports triggered by fromlist for modules that don't

0 commit comments

Comments
 (0)