[issue9257] cElementTree iterparse requires events as bytes; ElementTree uses strings
Eric Talevich added the comment: This bug seems to be still present in Python 3.1.2. (Unless I'm doing something wrong.) Was r78942 included in the 3.1.2 release? -- ___ Python tracker <http://bugs.python.org/issue9257> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9257] cElementTree iterparse requires events as bytes; ElementTree uses strings
Eric Talevich added the comment: It's more-or-less fixed in Python 3.2: - With cElementTree, both bytes and strings are accepted for events; - With ElementTree, only strings are accepted, and bytes raise a ValueError (unknown event). A small inconsistency remains, but it's fine to just use strings in all cases. -- ___ Python tracker <http://bugs.python.org/issue9257> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9257] cElementTree iterparse requires events as bytes; ElementTree uses strings
Eric Talevich added the comment: Well, this is not the best month for me to try digging into a new codebase... I would not mind if someone else did the patch for this. -- ___ Python tracker <http://bugs.python.org/issue9257> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9257] cElementTree iterparse requires events as bytes; ElementTree uses strings
New submission from Eric Talevich : In xml.etree, ElementTree and cElementTree implement different interfaces for the iterparse function/class. In ElementTree, the argument "events" must be a tuple of strings: from xml.etree import ElementTree as ET for result in ET.iterparse('example.xml', events=('start', 'end')): print(result) That works, given a valid XML file 'example.xml'. If the event names are given as bytes instead of strings (b'start', b'end'), there's no crash, but no events are recognized. In cElementTree, it's the opposite: the events argument must be a tuple of bytes: from xml.etree import cElementTree as cET for result in cET.iterparse('example.xml', events=(b'start', b'end')): print(result) Giving a tuple of strings instead of bytes results in: >>> for result in cET.iterparse('example.xml', events=('start', 'end')): ... print(result) TypeError: invalid event tuple This makes it difficult to use ElementTree as a backup for cElementTree, or at least very awkward. -- components: Library (Lib) messages: 110252 nosy: eric-talevich priority: normal severity: normal status: open title: cElementTree iterparse requires events as bytes; ElementTree uses strings versions: Python 3.1 ___ Python tracker <http://bugs.python.org/issue9257> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2734] 2to3 converts long(itude) argument to int
Eric Talevich added the comment: This issue still occurs when the name "long" is a function argument: def double(long): return long * 2 2to3 converts it to: def double(long): return int * 2 Should I file a new bug, or can someone reopen this? -- nosy: +eric-talevich versions: +Python 2.7 -Python 3.0 Added file: http://bugs.python.org/file18135/long_fixer_bug.py ___ Python tracker <http://bugs.python.org/issue2734> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com