mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Python: Handle diagnostics writing for BuiltinModuleExtractable
This commit is contained in:
@@ -373,7 +373,8 @@ def syntax_error_message(exception, unit):
|
||||
return error
|
||||
|
||||
def recursion_error_message(exception, unit):
|
||||
l = Location(file=unit.path)
|
||||
# if unit is a BuiltinModuleExtractable, there will be no path attribute
|
||||
l = Location(file=getattr(unit, "path", str(unit)))
|
||||
return (DiagnosticMessage(Source("py/diagnostics/recursion-error", "Recursion error in Python extractor"), Severity.ERROR)
|
||||
.with_location(l)
|
||||
.text(exception.args[0])
|
||||
@@ -383,7 +384,8 @@ def recursion_error_message(exception, unit):
|
||||
)
|
||||
|
||||
def internal_error_message(exception, unit):
|
||||
l = Location(file=unit.path)
|
||||
# if unit is a BuiltinModuleExtractable, there will be no path attribute
|
||||
l = Location(file=getattr(unit, "path", str(unit)))
|
||||
return (DiagnosticMessage(Source("py/diagnostics/internal-error", "Internal error in Python extractor"), Severity.ERROR)
|
||||
.with_location(l)
|
||||
.text("Internal error")
|
||||
|
||||
Reference in New Issue
Block a user