[issue6266] cElementTree.iterparse & ElementTree.iterparse return differently encoded strings
nlopes added the comment: This is a pretty dumb patch, but it does it's job. Basically it decodes the utf-8 encoded prefix and uri. Then, encodes it into Latin1. Probably there are better ways of doing this and those ideas are welcome. Patch attached. -- keywords: +patch nosy: +nlopes Added file: http://bugs.python.org/file14324/_elementtree.diff ___ Python tracker <http://bugs.python.org/issue6266> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6266] cElementTree.iterparse & ElementTree.iterparse return differently encoded strings
nlopes added the comment: You're right about the conversion to Latin1. I actually played a bit with makestring before going in another direction (although not very good) because makestring alone wasn't giving what is intended. I'll try to check tomorrow a good approach for this (already had that in mind). -- ___ Python tracker <http://bugs.python.org/issue6266> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6266] cElementTree.iterparse & ElementTree.iterparse return differently encoded strings
nlopes added the comment:
I got pure gibberish output, but I know why. It was a compilation gone
wrong.
To get the output as ElementTree, I think instead of
parcel = Py_BuildValue("sN", (prefix) ? prefix : "", makestring(uri));
it should be
parcel = Py_BuildValue("sN", (prefix) ? prefix : "",
PyUnicode_AsUnicode(makestring(uri), strlen(uri)));
Else it will not be the expected result.
Or am I overseeing something?
--
___
Python tracker
<http://bugs.python.org/issue6266>
___
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6266] cElementTree.iterparse & ElementTree.iterparse return differently encoded strings
nlopes added the comment: Don't mind what I just said. I overlooked the N. I couldn't figure out what was going wrong with your solution. That works. Mine is a ... aham. :) -- ___ Python tracker <http://bugs.python.org/issue6266> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6266] cElementTree.iterparse & ElementTree.iterparse return differently encoded strings
Changes by nlopes : Removed file: http://bugs.python.org/file14324/_elementtree.diff ___ Python tracker <http://bugs.python.org/issue6266> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6323] Py3.1 pdb doesn't deal well with syntax errors
nlopes added the comment:
I can reproduce it in my OpenBSD 4.5 box (only one I tried).
This simple code:
print(3
seems to break the pdb flow in python 3.1 the way Andreas described it.
When I tried in 2.7, this is what I get:
-bash-3.2$ ./python -m pdb test.py
SyntaxError: ('invalid syntax', ('test.py', 2, 8, ''))
> (1)()
(Pdb) q
[20367 refs]
-bash-3.2$
--
nosy: +nlopes
___
Python tracker
<http://bugs.python.org/issue6323>
___
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6323] Py3.1 pdb doesn't deal well with syntax errors
nlopes added the comment:
That fixes it.
It seems to be introduced when committing a fix for issue #1038.
-bash-3.2$ svn diff -r 58126:58127 Lib/pdb.py
Index: Lib/pdb.py
===
--- Lib/pdb.py (revision 58126)
+++ Lib/pdb.py (revision 58127)
@@ -1166,12 +1166,8 @@
self._wait_for_mainpyfile = 1
self.mainpyfile = self.canonic(filename)
self._user_requested_quit = 0
-fp = open(filename)
-try:
-script = fp.read()
-finally:
-fp.close()
-statement = 'exec("%s")' % script
+with open(filename) as fp:
+statement = fp.read()
self.run(statement)
# Simplified interface
--
___
Python tracker
<http://bugs.python.org/issue6323>
___
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
