New submission from Kaoru Esashika <kaoru.esash...@gmail.com>:

How to reproduction:
Step 1: make bad source code
Step 2: run "python -m py_compile bad_source_code.py"
Step 3: errors printed

It seems that this problem is introduced at issue 22640 (commit 
https://github.com/python/cpython/commit/2e33ecd7c9b0cac3efc6fcbdd4547fd086b4e2d1)
and it have not fixed yet.

variable 'quiet' is not defined in main function as far as I can see.

```
Traceback (most recent call last):
  File "c:\users\<USERNAME>\.scoop\apps\python\3.8.0\Lib\py_compile.py", line 
144, in compile
    code = loader.source_to_code(source_bytes, dfile or file,
  File "<frozen importlib._bootstrap_external>", line 846, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "c:/Users/<USERNAME>/AppData/Local/Temp/flycheckrIYLj4/test.py", line 25
    def calc_entropy(self):
    ^
IndentationError: expected an indented block

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\<USERNAME>\.scoop\apps\python\3.8.0\Lib\py_compile.py", line 
209, in main
    compile(filename, doraise=True)
  File "c:\users\<USERNAME>\.scoop\apps\python\3.8.0\Lib\py_compile.py", line 
150, in compile
    raise py_exc
__main__.PyCompileError: Sorry: IndentationError: expected an indented block 
(c:/Users/<USERNAME>/AppData/Local/Temp/flycheckrIYLj4/test.py, line 25)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\<USERNAME>\.scoop\apps\python\3.8.0\Lib\runpy.py", line 192, 
in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\<USERNAME>\.scoop\apps\python\3.8.0\Lib\runpy.py", line 85, in 
_run_code
    exec(code, run_globals)
  File "c:\users\<USERNAME>\.scoop\apps\python\3.8.0\Lib\py_compile.py", line 
218, in <module>
    sys.exit(main())
  File "c:\users\<USERNAME>\.scoop\apps\python\3.8.0\Lib\py_compile.py", line 
213, in main
    if quiet < 2:
NameError: name 'quiet' is not defined

```

----------
components: Library (Lib)
messages: 356173
nosy: Kaoru Esashika
priority: normal
severity: normal
status: open
title: bad input crashes py_compile library
type: crash
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38731>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to