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.

Author serhiy.storchaka
Recipients Leo Singer, Marcel H2, bethard, eli.bendersky, evan_, josh.r, markgrandi, moritz, naufraghi, palaviv, paul.j3, r.david.murray, sedrubal, serhiy.storchaka
Date 2018-09-11.14:38:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The solution with fileno() is clever, but as was mentioned before, it doesn't work if stdin or stdout are not real files, but something like StringIO. It is not that in common use of argparse for parsing arguments in scripts they are redefined, but argparse can be used in uncommon environments, for example for emulating command line in the environment like IDLE which redefines standard streams. And I'm sure this will break third-party tests which main() with patched stdin/stdout for testing CLI. The initial solution proposed by Moritz is more reliable, although it doesn't fix an issues with closing stdin/stdout. But this is a different issue at all.
Date User Action Args
2018-09-11 14:38:56serhiy.storchakasetrecipients: + serhiy.storchaka, bethard, naufraghi, r.david.murray, eli.bendersky, paul.j3, moritz, markgrandi, josh.r, palaviv, evan_, sedrubal, Marcel H2, Leo Singer
2018-09-11 14:38:56serhiy.storchakasetmessageid: <>
2018-09-11 14:38:56serhiy.storchakalinkissue14156 messages
2018-09-11 14:38:56serhiy.storchakacreate