Message104920
| Author |
vstinner |
| Recipients |
Arfrever, ezio.melotti, gregory.p.smith, lemburg, loewis, pitrou, vstinner |
| Date |
2010年05月04日.10:49:43 |
| SpamBayes Score |
1.1328968e-06 |
| Marked as misclassified |
No |
| Message-id |
<1272970191.2.0.239428377439.issue8603@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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() |
|