Message104920
New version of my patch, which looks much better. Summary:
Issue #8603: Create os.environb and os.getenvb() on POSIX system.
os.unsetenv() encodes str argument using file system encoding and
surrogateescape error handler (instead of utf8/strict), and accept bytes.
Changes with my previous patch:
- update os module documentation
- os.getenv() only accepts str, os.getenvb() only accepts bytes (to avoid mojibake)
- fix test_environb() of test_os for ASCII locale
- fix os.putenv() if key is an unicode string: use the string encoded to bytes as key for posix_putenv_garbage
- _Envion.__setitem__() encodes the key and value before calling putenv()
- _Environ.__delitem__() encodes the key before calling unsetenv()
- create a temporary function to create os.environ (to use temporary variables like encode, decode, keymap, data)
- annotation types in os.getenv() and os.getenvb()
- remove fsencode()/fsdecode() from the patch and don't touch os._execvpe() (will be fixed in other issues)
- putenv() uses PyBytes_GET_SIZE() instead of strlen() |
|
Date |
User |
Action |
Args |
2010-05-04 10:49:51 | vstinner | set | recipients:
+ vstinner, lemburg, loewis, gregory.p.smith, pitrou, ezio.melotti, Arfrever |
2010-05-04 10:49:51 | vstinner | set | messageid: <1272970191.2.0.239428377439.issue8603@psf.upfronthosting.co.za> |
2010-05-04 10:49:49 | vstinner | link | issue8603 messages |
2010-05-04 10:49:49 | vstinner | create | |
|