This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Complete adding silent mode for py_compile
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.9
Status: closed Resolution: duplicate
Dependencies: Superseder: bad input crashes py_compile library
View: 38731
Assigned To: Nosy List: Gregory Shevchenko, berker.peksag, cameron, nanjekyejoannah, vstinner
Priority: normal Keywords: patch

Created on 2020-04-30 22:25 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 17134 merged Gregory Shevchenko, 2020-04-30 22:30
Messages (3)
msg367790 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-30 22:25
pyflakes found 3 errors:

Lib/ undefined name 'quiet'
Lib/ undefined name 'quiet'
Lib/ undefined name 'quiet'

It seems like the code was introduced by PR 12976:

commit 2e33ecd7c9b0cac3efc6fcbdd4547fd086b4e2d1
Author: Joannah Nanjekye <>
Date:   Tue May 28 13:29:04 2019 -0300

    bpo-22640: Add silent mode to py_compile.compile() (GH-12976)
msg373791 - (view) Author: Cameron Simpson (cameron) * Date: 2020-07-17 01:58
Since bad input causes to issue an error like this:

  File "/usr/local/Cellar/python@3.8/3.8.3/Frameworks/Python.framework/Versions/3.8/lib/python3.8/", line 213, in main
    if quiet < 2:
NameError: name 'quiet' is not defined

I suggest, to save long review of a larger PR elsewhere, can we please just initially apply a patch like this:

[~/src/cpython(git:py_compile-quiet-not-initialised)]fleet2*> diff
+ exec git diff
diff --git a/Lib/ b/Lib/
index 21736896af..cea851274d 100644
--- a/Lib/
+++ b/Lib/
@@ -186,6 +186,7 @@ def main(args=None):
     if args is None:
         args = sys.argv[1:]
+    quiet = 0
     rv = 0
     if args == ['-']:
         while True:

Then the runtime issue goes away, and adding the feature fully can be addressed in a more leisurely fashion.
msg374275 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2020-07-25 19:17
This is a duplicate of issue 38731. The inline patch in msg373791 is incorrect. I'll fix the error in maintenance releases by partially reverting commit 2e33ecd7c9b0cac3efc6fcbdd4547fd086b4e2d1.
Date User Action Args
2022-04-11 14:59:30adminsetgithub: 84636
2020-07-25 19:17:47berker.peksagsetstatus: open -> closed

superseder: bad input crashes py_compile library

nosy: + berker.peksag
messages: + msg374275
resolution: duplicate
stage: patch review -> resolved
2020-07-17 01:58:44cameronsetnosy: + cameron
messages: + msg373791
2020-04-30 22:30:28Gregory Shevchenkosetkeywords: + patch
nosy: + Gregory Shevchenko
pull_requests: + pull_request19144
2020-04-30 22:30:00eric.araujosettitle: py_compile.main(): undefined name 'quiet' -> Complete adding silent mode for py_compile
type: behavior
stage: patch review
2020-04-30 22:25:30vstinnercreate