[New-bugs-announce] [issue40527] Multiple "unknown option" errors when passing unknown arguments to the interpreter

Florian Bruhin report at bugs.python.org
Wed May 6 05:32:05 EDT 2020


New submission from Florian Bruhin <python.org at the-compiler.org>:

A minor issue I just discovered today: When e.g. doing "python3 --foo", the output is:

  unknown option --foo
  unknown option --foo
  unknown option --foo
  usage: /usr/bin/python3 [option] ... [-c cmd | -m mod | file | -] [arg] ...

With more dashes in the options, it seems to get worse:

  unknown option --foo-bar-baz
  unknown option --foo-bar-baz
  unknown option --foo-bar-baz
  unknown option --foo-bar-baz
  unknown option --foo-bar-baz
  unknown option --foo-bar-baz
  unknown option --foo-bar-baz
  usage: /usr/bin/python3 [option] ... [-c cmd | -m mod | file | -] [arg] ...

This seems very similar to issue16306 (thus why I added people involved there to the nosy list), except that it happens with long rather than short arguments.

This only happens with Python 3.8/3.9, not 3.7 or older. I was able to bisect this to the following commit:

commit 6dcb54228e7520abd058897440c26e323f62afcd
Author: Victor Stinner <vstinner at redhat.com>
Date:   Tue Mar 5 02:44:12 2019 +0100

    bpo-36142: Add _PyPreConfig_ReadFromArgv() (GH-12173)
    
    The new function is now responsible to parse -E and -I command line
    arguments.

----------
components: Interpreter Core
messages: 368231
nosy: The Compiler, hieu.nguyen, serhiy.storchaka, tweksteen, vstinner
priority: normal
severity: normal
status: open
title: Multiple "unknown option" errors when passing unknown arguments to the interpreter
type: behavior
versions: Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40527>
_______________________________________


More information about the New-bugs-announce mailing list