[Python-Dev] Python-3.0, unicode, and os.environ

Adam Olsen rhamph at gmail.com
Thu Dec 4 22:40:05 CET 2008


On Thu, Dec 4, 2008 at 2:19 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Toshio Kuratomi wrote:
>> The bug report I opened suggests creating a PEP to address this issue.
>> I think that's a good idea for whether os.listdir() and friends should
>> be changed to raise an exception but not having any way to get at some
>> environment variables seems like it's just a bug that needs to be
>> addressed.  What do other people think on both these issues?
>
> I'm pretty sure the discussion on this topic a while back decided that
> where necessary Python 3 would grow parallel bytes versions of APIs
> affected by environmental encoding issues (such as os.environb,
> os.listdirb, os.getcwdb), but that we were OK with the idea of deferring
> addition of those APIs until 3.1.

It looks like most of them got into 3.0.
http://docs.python.org/3.0/library/os.html says "All functions
accepting path or file names accept both bytes and string objects, and
result in an object of the same type, if a path or file name is
returned."


> That is, this was an acknowledged limitation with a fairly
> straightforward agreed solution, but it wasn't considered a common
> enough issue to delay the release of 3.0 until all of those parallel
> APIs had been implemented

Aye.  IMO it's fairly clear that os.getenv()/os.putenv() should follow
suit in 3.1.  I'm not so sure about adding os.environb (and making
subprocess use it), unless the OP can demonstrate they really need it.

-- 
Adam Olsen, aka Rhamphoryncus


More information about the Python-Dev mailing list