[New-bugs-announce] [issue23811] Python py_compile error message inconsistent and missing newline

Akshet Pandey report at bugs.python.org
Mon Mar 30 13:58:58 CEST 2015


New submission from Akshet Pandey:

On the following test file (test.py):

```python
class Solution:
  def repeatedNumber(self, A):
    test = 1
      return []
```

Running python -m py_compile test.py return the following error message:
Sorry: IndentationError: unexpected indent (test.py, line 6)

But without a newline on stderr at the end of the message. This causes some problems with scripts that expect a newline and new my particular case with reading stderr on docker where docker just ignore the line if it doesn't end in a newline.

Also, this message differs from the runtime error message:

```
  File "test.py", line 6
    return []
    ^
IndentationError: unexpected indent
```

Would it be possible to at least add in a newline and at best, change the message to be consistent with the runtime error message?

I will trying to look at the code and see if I can write a patch but it will take me some time.

----------
components: Interpreter Core
messages: 239598
nosy: akshetp
priority: normal
severity: normal
status: open
title: Python py_compile error message inconsistent and missing newline
type: enhancement
versions: Python 2.7, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23811>
_______________________________________


More information about the New-bugs-announce mailing list