This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: test_os fails on 2.4
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, doerwalter, loewis, tim.peters
Priority: normal Keywords:

Created on 2005-02-17 05:22 by brett.cannon, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg24316 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2005-02-17 05:22
Seems at test for os.environ that uses to make 
sure the object returned by os.environ has a mapping 
environment is failing under 2.4 (fine under 2.5) at least on OS X:

test.test_support.TestFailed: Traceback (most recent call last):
  File "/Users/drifty/Code/cvs/Trees/python24/Lib/test/", line 204, in test_update
  File "/Users/drifty/Code/cvs/Trees/python24/Lib/", line 467, 
in update
    for k, v in items:
  File "/Users/drifty/Code/cvs/Trees/python24/Lib/test/", line 202, in __getitem__
    return self.d[i]
KeyError: 0
msg24317 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2005-02-17 15:39
Logged In: YES 

Confirming that test_os fails the same way on WinXP, on 
current release24-maint branch.  But it does not fail under 
the released 2.4.  Brett, can you clarify whether you're 
talking about 2.4 or about release24-maint here?
msg24318 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-02-17 21:24
Logged In: YES 

This is now fixed in 1.86 and, 1.30.
msg24319 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2005-02-17 21:30
Logged In: YES 

The new implementation of os._Environ.update() assumes that
the argument dict is a mapping, if it provides a method
items(), otherwise it treats it as an item sequence.
Unfortunately the SimpleUserDict from
provides only keys() and __getitem__().

So what is the minimal mapping interface? UserDict.DictMixin
claims that keys and __getitem__ (and __setitem__ and
__delitem__) is enough and adding __contains__, __iter__ and
iteritems increases performance.

So should update() try iteritems() or should an items()
method be added to the SimpleUserDict in the test?

CVS HEAD does not fail, because a test method test_update()
has been added there, which hides the original method from
mapping_tests.BasicTestMappingProtocol. Adding a call
there results in the same exception as on the
release24-maint branch.
msg24320 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2005-02-17 21:33
Logged In: YES 

Oops, seems are comments have crossed, thanks for the fix.
Date User Action Args
2022-04-11 14:56:09adminsetgithub: 41589
2005-02-17 05:22:06brett.cannoncreate