MCPcopy Index your code
hub / github.com/python/cpython / __init__

Method __init__

Lib/py_compile.py:46–60  ·  view source on GitHub ↗
(self, exc_type, exc_value, file, msg='')

Source from the content-addressed store, hash-verified

44 """
45
46 def __init__(self, exc_type, exc_value, file, msg=''):
47 exc_type_name = exc_type.__name__
48 if exc_type is SyntaxError:
49 tbtext = ''.join(traceback.format_exception_only(
50 exc_type, exc_value))
51 errmsg = tbtext.replace('File "<string>"', 'File "%s"' % file)
52 else:
53 errmsg = "Sorry: %s: %s" % (exc_type_name,exc_value)
54
55 Exception.__init__(self,msg or errmsg,exc_type_name,exc_value,file)
56
57 self.exc_type_name = exc_type_name
58 self.exc_value = exc_value
59 self.file = file
60 self.msg = msg or errmsg
61
62 def __str__(self):
63 return self.msg

Callers

nothing calls this directly

Calls 3

format_exception_onlyMethod · 0.80
joinMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected