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.

classification
Title: test_urllib.py fails in py3k r85440 with RuntimeError
Type: Stage:
Components: Library (Lib) Versions: Python 3.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: barry Nosy List: barry, orsenthil, pitrou
Priority: normal Keywords:

Created on 2010-10-13 22:46 by barry, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
10094.txt barry, 2010-10-14 18:09
Messages (9)
msg118598 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2010-10-13 22:46
Running the test suite on py3k r85440, I get the following failure:


======================================================================
ERROR: test_getproxies_environment_keep_no_proxies (__main__.ProxyTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_urllib.py", line 121, in setUp
    for k in os.environ.keys():
  File "/home/barry/projects/python/py3k/Lib/_abcoll.py", line 410, in __iter__
    for key in self._mapping:
  File "/home/barry/projects/python/py3k/Lib/os.py", line 441, in __iter__
    for key in self._data:
RuntimeError: dictionary changed size during iteration

This is consistent (i.e. fails every time) on Ubuntu 10.10 amd64.
msg118669 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2010-10-14 15:27
This may not be a Python bug.

The failure is consistent on all Ubuntu 10.10 machines I've tried, including both i386 and x86_64 platforms.  I've gone back many svn revisions and even pulled down earlier alpha tarballs and the failure is consistent.

This does *not* fail on the one Ubuntu 10.04 x86_64 VM I've tried.  Will try on Debian squeeze next.
msg118670 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2010-10-14 15:30
I have seen this in very inconsistent manner.
msg118671 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2010-10-14 15:35
Senthil, can you provide any additional information on where/when you've seen this?  AFAICT, test_urllib.py is the only test it shows up, but it's totally consistent.  What OS/platforms have you seen this happen on?  Same test or different one?
msg118696 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2010-10-14 17:19
I had seen with test_urllib, but it was inconsistent for me. Sometimes
make distclean and run had worked fine.

This was on Ubuntu 10.04, Intel 64 bit.

It is surprising, if it is seen consistently on Ubuntu 10.10 ( I have
not upgraded to this yet, so have not tried).
msg118705 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2010-10-14 18:09
The problem occurs on Ubuntu 10.10 because there's a new environment variable called $UBUNTU_MENUPROXY in the default user environment.  This is why it suddenly showed up in Python 3.1 and why it does not occur on other OS (even Ubuntu 10.04).

ProxyTests.setUp() conditional is too naive.  Will attach patch, commit and backport.
msg118710 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-10-14 18:29
Er, this patch is horrible. You should fix the generic bug, not workaround it on your particular environment. The test still fails with NO_PROXY:

$ NO_PROXY=1 ./python -m test.regrtest test_urllib
[1/1] test_urllib
Warning -- os.environ was modified by test_urllib
test test_urllib failed -- Traceback (most recent call last):
  File "/home/antoine/py3k/__svn__/Lib/test/test_urllib.py", line 121, in setUp
    for k in os.environ.keys():
  File "/home/antoine/py3k/__svn__/Lib/_abcoll.py", line 410, in __iter__
    for key in self._mapping:
  File "/home/antoine/py3k/__svn__/Lib/os.py", line 441, in __iter__
    for key in self._data:
RuntimeError: dictionary changed size during iteration
msg118711 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-10-14 18:32
Fixed in r85489, please backport.
msg119571 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2010-10-25 19:30
This was already backported but the issue wasn't closed.
History
Date User Action Args
2022-04-11 14:57:07adminsetgithub: 54303
2010-10-25 19:30:05barrysetstatus: open -> closed
resolution: fixed
messages: + msg119571
2010-10-14 18:32:07pitrousetmessages: + msg118711
versions: - Python 3.2
2010-10-14 18:29:57pitrousetstatus: closed -> open

nosy: + pitrou
messages: + msg118710

assignee: barry
resolution: fixed -> (no value)
2010-10-14 18:24:18barrysetstatus: open -> closed
resolution: fixed
2010-10-14 18:09:25barrysetversions: + Python 3.1
2010-10-14 18:09:10barrysetfiles: + 10094.txt

messages: + msg118705
2010-10-14 17:19:39orsenthilsetmessages: + msg118696
title: test_urllib.py fails with RuntimeError on Ubuntu 10.10 -> test_urllib.py fails in py3k r85440 with RuntimeError
2010-10-14 16:17:57barrysettitle: test_urllib.py fails in py3k r85440 with RuntimeError -> test_urllib.py fails with RuntimeError on Ubuntu 10.10
2010-10-14 15:35:24barrysetmessages: + msg118671
2010-10-14 15:30:21orsenthilsetnosy: + orsenthil
messages: + msg118670
2010-10-14 15:27:53barrysetmessages: + msg118669
2010-10-13 22:46:20barrycreate