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.
Created on 2013年09月04日 12:30 by wolma, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue18920.1.patch | eli.bendersky, 2013年09月04日 13:49 | |||
| Messages (13) | |||
|---|---|---|---|
| msg196905 - (view) | Author: Wolfgang Maier (wolma) * | Date: 2013年09月04日 12:30 | |
Hi, I just noticed that version output generated via the **'version' action** of the **argparse** module is routed to stderr. I'd expect regular output to go to stdout instead. The current behavior also seems inconsistent to me because --help prints to stdout. Best, Wolfgang |
|||
| msg196908 - (view) | Author: Eli Bendersky (eli.bendersky) * (Python committer) | Date: 2013年09月04日 13:17 | |
Yes, it seems like an oversight to me. Printing --version to stdout is more customary (Python itself does it, and most other tools do too). A question comes up about backwards compatibility. I would definitely not change it in 2.x - it's just not worth it. As for 3.x, should this go into 3.3 too or just 3.4? |
|||
| msg196910 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2013年09月04日 13:26 | |
Only on 3.4. Python prints the version on stdout since 3.4 -- before it used stderr: 3.3$ ./python -V 2> /dev/null 3.3$ ./python -V > /dev/null Python 3.3.2+ 3.4$ ./python -V 2> /dev/null Python 3.4.0a1+ 3.4$ ./python -V > /dev/null This might also explain why argparse uses stderr (other modules/scripts in the stdlib might do the same too). |
|||
| msg196911 - (view) | Author: Eli Bendersky (eli.bendersky) * (Python committer) | Date: 2013年09月04日 13:34 | |
On Wed, Sep 4, 2013 at 6:26 AM, Ezio Melotti <report@bugs.python.org> wrote: > > Ezio Melotti added the comment: > > Only on 3.4. > Python prints the version on stdout since 3.4 -- before it used stderr: > 3.3$ ./python -V 2> /dev/null > 3.3$ ./python -V > /dev/null > Python 3.3.2+ > > 3.4$ ./python -V 2> /dev/null > Python 3.4.0a1+ > 3.4$ ./python -V > /dev/null > > This might also explain why argparse uses stderr (other modules/scripts in > the stdlib might do the same too). > Ah, right. On 3.4 Python's main.c uses printf for --version; on earlier versions it's fprintf(stderr...) I guess it's a no-brainer then; 3.4 has to be changed, but not earlier versions. I'll whip up a quick patch. |
|||
| msg196912 - (view) | Author: Eli Bendersky (eli.bendersky) * (Python committer) | Date: 2013年09月04日 13:36 | |
The Python executable change is from #18338 |
|||
| msg196916 - (view) | Author: Eli Bendersky (eli.bendersky) * (Python committer) | Date: 2013年09月04日 13:49 | |
Patch attached |
|||
| msg196918 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年09月04日 14:03 | |
> This might also explain why argparse uses stderr (other modules/scripts in the stdlib might do the same too). Lib/trace.py, Tools/pynche/Main.py, and Tools/i18n/pygettext.py write to the stdout. Lib/smtpd.py and Tools/i18n/msgfmt.py write to the stderr. The optparse module also writes to the stdout. |
|||
| msg196919 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年09月04日 14:13 | |
You misplace Misc/NEWS entry in wrong section -- "What's New in Python 3.4.0 Alpha 1". I think this change (as change of issue18338) worths the mentioning in Doc/whatsnew/3.4.rst. Did you run all test suite? This change can affect other tests. |
|||
| msg197068 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年09月06日 13:49 | |
New changeset ec9a4b77f37b by Eli Bendersky in branch 'default': Issue #18920: argparse's default version action (for -v, --version) should http://hg.python.org/cpython/rev/ec9a4b77f37b |
|||
| msg197069 - (view) | Author: Eli Bendersky (eli.bendersky) * (Python committer) | Date: 2013年09月06日 13:50 | |
Thanks, I moved the NEWS entry to the right place. Yes, all tests pass. I'll update whatsnew separately. |
|||
| msg197072 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年09月06日 13:56 | |
New changeset 587bdb940524 by Eli Bendersky in branch 'default': Update whatsnew/3.4 wrt. --version going to stdout. #18338, #18920, #18922 http://hg.python.org/cpython/rev/587bdb940524 |
|||
| msg314373 - (view) | Author: Stefan Sauer (Stefan Sauer) | Date: 2018年03月24日 15:04 | |
Is there a workaround for python2? The issue is that autotools is checking that installed tools support --help and --version and it expects those to stdout:
bad=0; pid=$$; list="gtkdoc-check gtkdoc-depscan gtkdoc-fixxref gtkdoc-mkdb gtkdoc-mkhtml gtkdoc-mkhtml2 gtkdoc-mkman gtkdoc-mkpdf gtkdoc-rebase gtkdoc-scan gtkdoc-scangobj gtkdocize"; for p in $list; do \
case ' ' in \
*" $p "* | *" ../../$p "*) continue;; \
esac; \
f=`echo "$p" | sed 's,^.*/,,;s,x,x,'`; \
for opt in --help --version; do \
if "/home/ensonic/projects/gnome/gtk-doc/gtk-doc-1.27.1/_inst/bin/$f" $opt >c${pid}_.out \
2>c${pid}_.err </dev/null \
&& test -n "`cat c${pid}_.out`" \
&& test -z "`cat c${pid}_.err`"; then :; \
else echo "$f does not support $opt" 1>&2; bad=1; fi; \
done; \
done; rm -f c${pid}_.???; exit $bad
gtkdoc-check does not support --version
gtkdoc-fixxref does not support --version
gtkdoc-mkdb does not support --version
gtkdoc-mkhtml does not support --version
gtkdoc-mkhtml2 does not support --version
gtkdoc-mkman does not support --version
gtkdoc-mkpdf does not support --version
gtkdoc-rebase does not support --version
gtkdoc-scan does not support --version
gtkdoc-scangobj does not support --version
Makefile:637: recipe for target 'installcheck-binSCRIPTS' failed
|
|||
| msg314374 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2018年03月24日 16:17 | |
You can implement your own version action which outputs to stdout and use it for -V and --version. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:50 | admin | set | github: 63120 |
| 2018年03月24日 16:17:16 | serhiy.storchaka | set | messages: + msg314374 |
| 2018年03月24日 15:04:25 | Stefan Sauer | set | nosy:
+ Stefan Sauer messages: + msg314373 |
| 2016年07月04日 16:48:49 | jwilk | set | nosy:
+ jwilk title: argparse module version action -> argparse version action should print to stdout, not stderr |
| 2013年09月06日 13:57:07 | eli.bendersky | set | status: open -> closed stage: patch review -> resolved resolution: fixed versions: - Python 3.4 |
| 2013年09月06日 13:56:39 | python-dev | set | messages: + msg197072 |
| 2013年09月06日 13:50:24 | eli.bendersky | set | messages: + msg197069 |
| 2013年09月06日 13:49:54 | python-dev | set | nosy:
+ python-dev messages: + msg197068 |
| 2013年09月04日 14:13:10 | serhiy.storchaka | set | messages: + msg196919 |
| 2013年09月04日 14:03:43 | serhiy.storchaka | set | messages: + msg196918 |
| 2013年09月04日 13:49:32 | eli.bendersky | set | files:
+ issue18920.1.patch keywords: + patch messages: + msg196916 stage: needs patch -> patch review |
| 2013年09月04日 13:36:11 | eli.bendersky | set | messages: + msg196912 |
| 2013年09月04日 13:34:23 | eli.bendersky | set | messages: + msg196911 |
| 2013年09月04日 13:26:47 | ezio.melotti | set | nosy:
+ ezio.melotti messages: + msg196910 keywords: + easy stage: needs patch |
| 2013年09月04日 13:17:59 | eli.bendersky | set | nosy:
+ eli.bendersky, serhiy.storchaka, bethard messages: + msg196908 versions: + Python 3.4, - Python 3.2, Python 3.3 |
| 2013年09月04日 12:30:47 | wolma | create | |