[New-bugs-announce] [issue45101] Small inconsistency in usage message between the python and shell script versions of python-config
Kien Dang
report at bugs.python.org
Sat Sep 4 14:32:12 EDT 2021
New submission from Kien Dang <mail at kien.ai>:
`python-config` outputs a usage instruction message in case either the `--help` option or invalid arguments are provided.
However there is a small different in the output I/O between the python and shell script versions of `python-config`. In the python version, the message always prints to `stderr`.
https://github.com/python/cpython/blob/bc1c49fa94b2abf70e6937373bf1e6b5378035c5/Misc/python-config.in#L15-L18
def exit_with_usage(code=1):
print("Usage: {0} [{1}]".format(
sys.argv[0], '|'.join('--'+opt for opt in valid_opts)), file=sys.stderr)
sys.exit(code)
while in the shell script version it always prints to `stdout`.
https://github.com/python/cpython/blob/bc1c49fa94b2abf70e6937373bf1e6b5378035c5/Misc/python-config.sh.in#L5-L9
exit_with_usage ()
{
echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed"
exit $1
}
This inconsistency does not affect most users of `python-config`, who runs the script interactively. However it might cause issues when run programmatically.
----------
components: Demos and Tools
messages: 401054
nosy: kiendang
priority: normal
severity: normal
status: open
title: Small inconsistency in usage message between the python and shell script versions of python-config
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45101>
_______________________________________
More information about the New-bugs-announce
mailing list