On 05:56 pm, guido@python.org wrote:
On Tue, Sep 30, 2008 at 10:59 AM, <glyph@divmod.com> wrote:
On 02:32 pm, guido@python.org wrote:
In the absence of a 2.6 getcwdb, perhaps the fixer could just drop the "benefit of the doubt" case? It could always be added to 2.7, and the parity release of 2to3 could have a --2.7 switch that would modify the behavior of this and other fixers.
I'm not sure what you're proposing. *My* proposal is that 2to3 changes os.getcwdu() calls to os.getcwd() and leaves os.getcwd() calls alone -- there's no way to tell whether os.getcwdb() would be a better match, and for portable code, it won't be (since os.getcwdb() is a Unix-only thing).
My proposal is simply to change getcwd to getcwdb, and getcwdu to getcwd. This preserves whatever bytes/text behavior you are expecting from 2.6 into 3.0. Granted, the fact that unicode is really always the right thing to do on Windows complicates things. I already tend to avoid os.getcwd() though, and this is just one more reason to avoid it. In the rare cases where I really do need it, it looks like os.path.abspath(b".") / os.path.abspath(u".") will provide the clarity that I want.