Add authorized_imports in importFrom errors (#506)

This commit is contained in:
CalOmnie 2025-02-09 17:40:16 +01:00 committed by GitHub
parent 881ce13635
commit 01c510658d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -1067,7 +1067,9 @@ def import_modules(expression, state, authorized_imports):
else:
raise InterpreterError(f"Module {expression.module} has no attribute {alias.name}")
else:
raise InterpreterError(f"Import from {expression.module} is not allowed.")
raise InterpreterError(
f"Import from {expression.module} is not allowed. Authorized imports are: {str(authorized_imports)}"
)
return None