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

Function convert_error

Tools/c-analyzer/c_parser/preprocessor/common.py:121–139  ·  view source on GitHub ↗
(tool, argv, filename, stderr, rc)

Source from the content-addressed store, hash-verified

119
120
121def convert_error(tool, argv, filename, stderr, rc):
122 error = (stderr.splitlines()[0], rc)
123 if (_expected := is_os_mismatch(filename, stderr)):
124 logger.info(stderr.strip())
125 raise OSMismatchError(filename, _expected, argv, error, tool)
126 elif (_missing := is_missing_dep(stderr)):
127 logger.info(stderr.strip())
128 raise MissingDependenciesError(filename, (_missing,), argv, error, tool)
129 elif '#error' in stderr:
130 # XXX Ignore incompatible files.
131 error = (stderr.splitlines()[1], rc)
132 logger.info(stderr.strip())
133 raise ErrorDirectiveError(filename, argv, error, tool)
134 else:
135 # Try one more time, with stderr written to the terminal.
136 try:
137 output = run_cmd(argv, stderr=None)
138 except subprocess.CalledProcessError:
139 raise PreprocessorFailure(filename, argv, error, tool)
140
141
142def is_os_mismatch(filename, errtext=None):

Callers 1

converted_errorFunction · 0.85

Calls 10

is_os_mismatchFunction · 0.85
OSMismatchErrorClass · 0.85
is_missing_depFunction · 0.85
ErrorDirectiveErrorClass · 0.85
run_cmdFunction · 0.85
PreprocessorFailureClass · 0.85
splitlinesMethod · 0.45
infoMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…