The _PyCompile_Error and _PyCompile_Warn functions take a compiler struct as parameter, just for the filename. In order to be able to use these functions from areas of the codebase where this does not exist, we need versions that take just the filename.
I think they should live in Python/errors.py, with _PyErr_ prefix.
Linked PRs