Bugs item #1124513, was opened at 2005-02-17 06:22 Message generated for change (Comment added) made by doerwalter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1124513&group_id=5470
Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Brett Cannon (bcannon) Assigned to: Nobody/Anonymous (nobody) Summary: test_os fails on 2.4 Initial Comment: Seems at test for os.environ that uses mapping_tests.py 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/ mapping_tests.py", line 204, in test_update d.update(SimpleUserDict()) File "/Users/drifty/Code/cvs/Trees/python24/Lib/os.py", line 467, in update for k, v in items: File "/Users/drifty/Code/cvs/Trees/python24/Lib/test/ mapping_tests.py", line 202, in __getitem__ return self.d[i] KeyError: 0 ---------------------------------------------------------------------- >Comment By: Walter Dörwald (doerwalter) Date: 2005-02-17 22:33 Message: Logged In: YES user_id=89016 Oops, seems are comments have crossed, thanks for the fix. ---------------------------------------------------------------------- Comment By: Walter Dörwald (doerwalter) Date: 2005-02-17 22:30 Message: Logged In: YES user_id=89016 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 mapping_tests.py 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 mapping_tests.BasicTestMappingProtocol.test_update(self) there results in the same exception as on the release24-maint branch. ---------------------------------------------------------------------- Comment By: Martin v. Löwis (loewis) Date: 2005-02-17 22:24 Message: Logged In: YES user_id=21627 This is now fixed in os.py 1.86 and 1.83.2.2, test_os.py 1.30. ---------------------------------------------------------------------- Comment By: Tim Peters (tim_one) Date: 2005-02-17 16:39 Message: Logged In: YES user_id=31435 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? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1124513&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com