Message215298
From http://bugs.python.org/issue14156
"argparse.FileType for '-' doesn't work for a mode of 'rb'"
I learned that 'stdin/out' can be embedded in an 'open' by using the 'fileno()' and 'closefd=False' (so it isn't closed at the end of open).
With this, the dummy file context that I implemented in the previous patch, could be replaced with:
partial(open, sys.stdin.fileno(), mode=self._mode,..., closefd=False)
However, as Steven Bethard wrote in the earlier issue, setting up tests when stdin/out will be redirected is not a trivial problem. So I don't yet have a testable patch.
---------------
And just for the record, the 'osaccess' testing that I wrote earlier, probably should also test that proposed output file string is not already a directory. |
|
Date |
User |
Action |
Args |
2014-04-01 07:36:51 | paul.j3 | set | recipients:
+ paul.j3, bethard, eric.araujo, Paolo.Elvati, manveru, Stefan.Pfeiffer, David.Layton |
2014-04-01 07:36:51 | paul.j3 | set | messageid: <1396337811.53.0.995154993809.issue13824@psf.upfronthosting.co.za> |
2014-04-01 07:36:51 | paul.j3 | link | issue13824 messages |
2014-04-01 07:36:50 | paul.j3 | create | |
|