Andrew Dalke added the comment:

Ahh, so the bug here that the environ dict should use neither UserDict nor 
dict, it should implement the core {get,set,del}item and keys and use 
DictMixin.

Martin mentioned that the patch doesn't support setdefault.  He didn't note 
though that the current code also doesn't support the dictionary interface 
consistently.  This shows a problem with popitem.

>>> import os
>>> os.environ["USER"]
'dalke'
>>> os.environ["USER"] = "nobody"
>>> os.system("echo $USER")
nobody
0
>>> del os.environ["USER"]
>>> os.system("echo $USER")

0
>>> os.environ["USER"] = "dalke"
>>> while os.environ: print os.environ.popitem()
... 
('GROUP', 'staff')
('XDG_DATA_HOME', '/Users/dalke/.local/share')
('TERM_PROGRAM_VERSION', '133')
('CVS_RSH', 'ssh')
('LOGNAME', 'dalke')
('USER', 'dalke')
    ... removed for conciseness ...
('QTDIR', '/usr/local/qt')
>>> os.system("echo $USER")
dalke
0
>>> 

Not enough people know about DictMixin.

_____________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1367711>
_____________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to