Skip to content

Commit 5063d06

Browse files
committed
Fix ImportError signature
1 parent 77d78da commit 5063d06

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

graalpython/lib-graalpython/exceptions.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,30 +55,14 @@ def SystemExit__init__(self, *args):
5555
SystemExit.__init__ = SystemExit__init__
5656
del SystemExit__init__
5757

58-
def ImportError__init__(self, msg, name=None, path=None):
59-
self.message = msg
58+
def ImportError__init__(self, msg=None, /, *args, name=None, path=None):
59+
self.msg = msg
6060
self.name = name
6161
self.path = path
6262

6363
ImportError.__init__ = ImportError__init__
6464
del ImportError__init__
6565

66-
def ModuleNotFoundError__init__(self, msg, name=None):
67-
self.msg = msg
68-
self.name = name
69-
70-
ModuleNotFoundError.__init__ = ModuleNotFoundError__init__
71-
del ModuleNotFoundError__init__
72-
73-
def ModuleNotFoundError__str__(self):
74-
if self.name is not None:
75-
return "ModuleNotFound: '" + self.name + "'. " + self.msg
76-
else:
77-
return "ModuleNotFound: " + self.msg
78-
79-
ModuleNotFoundError__str__.__init__ = ModuleNotFoundError__str__
80-
del ModuleNotFoundError__str__
81-
8266
# EnvironmentError is just an alias of OSError (i.e. 'EnvironmentError is OSError == True')
8367
EnvironmentError = OSError
8468

0 commit comments

Comments
 (0)