Message124688
The following was found testing the Biopython unit tests (latest code from git) against Python 3.2 beta 2 (compiled from source on 64 bit Linux Ubuntu). Reduced test case:
$ python3.2
Python 3.2b2 (r32b2:87398, Dec 26 2010, 19:01:30)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from xml.etree import ElementTree
>>> ElementTree.register_namespace("xs", "http://www.w3.org/2001/XMLSchema")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/peterjc/lib/python3.2/xml/etree/ElementTree.py", line 1071, in register_namespace
for k, v in _namespace_map.items():
RuntimeError: dictionary changed size during iteration
Suggested fix, replace this:
def register_namespace(prefix, uri):
if re.match("ns\d+$", prefix):
raise ValueError("Prefix format reserved for internal use")
for k, v in _namespace_map.items():
if k == uri or v == prefix:
del _namespace_map[k]
_namespace_map[uri] = prefix
with something like this:
def register_namespace(prefix, uri):
if re.match("ns\d+$", prefix):
raise ValueError("Prefix format reserved for internal use")
for k, v in list(_namespace_map.items()):
if k == uri or v == prefix:
del _namespace_map[k]
_namespace_map[uri] = prefix
Note that cElementTree seems to be OK.
Note that Python 3.1 was not affected as it didn't even have register_namespace,
$ python3
Python 3.1.2 (r312:79147, Sep 27 2010, 09:57:50)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from xml.etree import ElementTree
>>> ElementTree.register_namespace("xs", "http://www.w3.org/2001/XMLSchema")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'register_namespace' |
|
Date |
User |
Action |
Args |
2010-12-27 00:12:09 | maubp | set | recipients:
+ maubp |
2010-12-27 00:12:09 | maubp | set | messageid: <1293408729.9.0.0323219588466.issue10777@psf.upfronthosting.co.za> |
2010-12-27 00:11:54 | maubp | link | issue10777 messages |
2010-12-27 00:11:54 | maubp | create | |
|