Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bad input crashes py_compile library #82912

Closed
KaoruEsashika mannequin opened this issue Nov 7, 2019 · 9 comments
Closed

bad input crashes py_compile library #82912

KaoruEsashika mannequin opened this issue Nov 7, 2019 · 9 comments
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@KaoruEsashika
Copy link
Mannequin

KaoruEsashika mannequin commented Nov 7, 2019

BPO 38731
Nosy @berkerpeksag, @pablogsal, @miss-islington, @nanjekyejoannah, @gvsheva, @hubearth
PRs
  • bpo-38731: Add --quiet option to py_compile CLI #17134
  • [3.8] bpo-38731: Fix function signature of quiet in docs (GH-17719) #17725
  • [3.9] bpo-38731: Fix NameError in command-line interface of py_compile #21617
  • [3.8] bpo-38731: Fix NameError in command-line interface of py_compile (GH-21617) #21618
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-07-25.21:05:08.908>
    created_at = <Date 2019-11-07.06:53:38.315>
    labels = ['easy', 'type-bug', '3.8', '3.9', '3.10', 'library']
    title = 'bad input crashes py_compile library'
    updated_at = <Date 2020-07-25.21:05:08.905>
    user = 'https://bugs.python.org/KaoruEsashika'

    bugs.python.org fields:

    activity = <Date 2020-07-25.21:05:08.905>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-07-25.21:05:08.908>
    closer = 'berker.peksag'
    components = ['Library (Lib)']
    creation = <Date 2019-11-07.06:53:38.315>
    creator = 'Kaoru Esashika'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38731
    keywords = ['patch', 'easy']
    message_count = 9.0
    messages = ['356173', '358925', '358927', '372907', '372933', '372953', '374276', '374277', '374278']
    nosy_count = 7.0
    nosy_names = ['berker.peksag', 'pablogsal', 'miss-islington', 'nanjekyejoannah', 'Kaoru Esashika', 'Gregory Shevchenko', 'hubide']
    pr_nums = ['17134', '17725', '21617', '21618']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue38731'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    @KaoruEsashika
    Copy link
    Mannequin Author

    KaoruEsashika mannequin commented Nov 7, 2019

    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 bpo-22640 (commit 2e33ecd)
    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
    
    

    @KaoruEsashika KaoruEsashika mannequin added type-crash A hard crash of the interpreter, possibly with a core dump 3.8 only security fixes stdlib Python modules in the Lib dir labels Nov 7, 2019
    @berkerpeksag berkerpeksag added 3.9 only security fixes type-bug An unexpected behavior, bug, or error and removed type-crash A hard crash of the interpreter, possibly with a core dump labels Nov 7, 2019
    @pablogsal
    Copy link
    Member

    New changeset 98f0f04 by Pablo Galindo (Batuhan Taşkaya) in branch 'master':
    bpo-38731: Fix function signature of quiet in docs (GH-17719)
    98f0f04

    @miss-islington
    Copy link
    Contributor

    New changeset 04c1efe by Miss Islington (bot) in branch '3.8':
    bpo-38731: Fix function signature of quiet in docs (GH-17719)
    04c1efe

    @Hubearth
    Copy link
    Mannequin

    Hubearth mannequin commented Jul 3, 2020

    The bug is still there in python 3.8.4rc1
    It has nothing to do with the doc.

    As pointed by Kaoru, it is introduced in line 200 of commit 2e33ecd

    see this comment, also by Kaoru:
    2e33ecd#r35842880

    @Hubearth Hubearth mannequin removed the 3.9 only security fixes label Jul 3, 2020
    @nanjekyejoannah
    Copy link
    Contributor

    The regression is tracked here: https://bugs.python.org/issue40456

    And a PR is under review here: #17134

    Also, this issue is a duplicate to this: https://bugs.python.org/issue40456

    One of these should be closed.

    @Hubearth
    Copy link
    Mannequin

    Hubearth mannequin commented Jul 3, 2020

    Thanks Joannah, I confirm this is a duplicate of https://bugs.python.org/issue40456

    The issue is better tracked in 40456, so you can close here.

    @berkerpeksag
    Copy link
    Member

    New changeset daff390 by Gregory Schevchenko in branch 'master':
    bpo-38731: Add --quiet option to py_compile CLI (GH-17134)
    daff390

    @berkerpeksag
    Copy link
    Member

    New changeset 2024d7a by Berker Peksag in branch '3.9':
    bpo-38731: Fix NameError in command-line interface of py_compile (GH-21617)
    2024d7a

    @berkerpeksag
    Copy link
    Member

    New changeset 949cf93 by Miss Islington (bot) in branch '3.8':
    bpo-38731: Fix NameError in command-line interface of py_compile (GH-21617)
    949cf93

    @berkerpeksag berkerpeksag added 3.9 only security fixes 3.10 only security fixes labels Jul 25, 2020
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes 3.9 only security fixes 3.10 only security fixes easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    5 participants