Skip to content

py_compile CLI error message missing newline #118158

@bartlomiej-stefanski

Description

@bartlomiej-stefanski

Bug report

Bug description:

When attempting to run py_compile using its CLI (python3 -m py_compile test.py) on file with erroneous indentation, ex:

# test.py
  print("hello world")
# unexpected space characters before `print`

An error will be printed to stderr, but without a newline at the end.

Although the py_compile documentation does not specify the error message format, the lack of newline is unconventional and can lead to unexpected behavior of scripts dependent on it.

The same issue was already raised twice:

in both instances the newline was added thus the lack of one now seems to be unintentional.


If this is confirmed to be a bug I will attempt to write a fix for it.

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions