You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Multiple "unknown option" errors when passing unknown arguments to the interpreter #84707
This seems very similar to bpo-16306 (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:
Oh right, that's because Python parses the command line at least 3 times :-) The first 2 times, it is not supposed to log errors. It's a bug: attached PR 19955 fix it.
I was able to bisect this to the following commit: (...)
Oh, well done! Yeah, it's all my fault ;-) It's a regression of the PEP-587 (PyConfig) implementation.
I chose to share code between Python/preconfig.c and Python/initconfig.c rather than duplicate code. The implementation of _PyPreConfig_Read() and PyConfig_Read() is quite complex.
Activity
The-Compiler commentedon May 6, 2020
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 bpo-16306 (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 6dcb542
Author: Victor Stinner <vstinner@redhat.com>
Date: Tue Mar 5 02:44:12 2019 +0100
vstinner commentedon May 6, 2020
Oh right, that's because Python parses the command line at least 3 times :-) The first 2 times, it is not supposed to log errors. It's a bug: attached PR 19955 fix it.
vstinner commentedon May 6, 2020
Oh, well done! Yeah, it's all my fault ;-) It's a regression of the PEP-587 (PyConfig) implementation.
I chose to share code between Python/preconfig.c and Python/initconfig.c rather than duplicate code. The implementation of _PyPreConfig_Read() and PyConfig_Read() is quite complex.
corona10 commentedon May 6, 2020
New changeset 2668a9a by Victor Stinner in branch 'master':
bpo-40527: Fix command line argument parsing (GH-19955)
2668a9a
miss-islington commentedon May 6, 2020
New changeset bce4dda by Miss Islington (bot) in branch '3.8':
bpo-40527: Fix command line argument parsing (GH-19955)
bce4dda
corona10 commentedon May 6, 2020
Thanks for the bug report Florian and for work Victor!
I am now closing this issue :)
The-Compiler commentedon May 6, 2020
That was an insanely fast fix - thanks everyone! :)
vstinner commentedon May 6, 2020
Sorry about that. We are working on this issue to ensure that next bugs will not fixed as quickly a this done ;-)