Message105080
| Author |
loewis |
| Recipients |
Arfrever, ezio.melotti, gregory.p.smith, lemburg, loewis, pitrou, vstinner |
| Date |
2010年05月05日.19:43:21 |
| SpamBayes Score |
1.0886428e-05 |
| Marked as misclassified |
No |
| Message-id |
<4BE1CA58.4090109@v.loewis.de> |
| In-reply-to |
<1273018801.04.0.0525000713993.issue8603@psf.upfronthosting.co.za> |
| Content |
> @loewis: So do you agree to add os.environb and os.getenvb()?
I agree with the patch (-2) in principle. I think the error handling
needs to improve:
py> os.getenvb('PATH')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/martin/work/3k/Lib/os.py", line 484, in getenvb
return environb.get(key, default)
File "/home/martin/work/3k/Lib/_abcoll.py", line 357, in get
return self[key]
File "/home/martin/work/3k/Lib/os.py", line 400, in __getitem__
value = self.data[self.encodekey(key)]
TypeError: string argument without an encoding
which then leads to the natural, but incorrect
py> os.getenvb('PATH', encoding='ascii')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: getenvb() got an unexpected keyword argument 'encoding'
The first error should remain TypeError, but say something like
"unsupported type string", or "bytes expected".
I notice an incompatible change: posix.environ has now a different
element type. This is probably fine.
There is a couple of white-space only changes in the patch; it would be
good if you could reduce them. |
|