New submission from Gunnar Aastrand Grimnes :
The startElementNS method in the XMLGenerator ignores the encoding set.
it does:
self._out.write(' xmlns:%s="%s"' % (prefix, uri))
whereas it should have done:
self._write(' xmlns:%s="%s"' % (prefix,
Gunnar Aastrand Grimnes added the comment:
I came across the bug when trying to write XML documents to StringIO objects.
This does not work, since the output contains a mix of unicode and str objects,
and StringIO gets confused.
A better alternative is to use io.BytesIO, since all output
New submission from Gunnar Aastrand Grimnes:
This script, using requests and multiprocessing, will segfault on MacOS 16.4.0
with python 3.6.1. In 3.6.0 it runs fine.
The program is reduced from a much larger program, some weird things need to be
present to trigger the crash. For instance the
Gunnar Aastrand Grimnes added the comment:
I am unable to reduce it to a small(ish) test-case like for 3.6.1, but I can
also get 2.7.1 to seg fault in my original program, and the stack trace is
similar:
Process: Python [4023]
Path:
/usr/local/Cellar/python
Gunnar Aastrand Grimnes added the comment:
Adding env no_proxy='*' does indeed fix it!
Thanks a lot!
I guess it's pretty hard to fix. Or even to detect, so that one could log a
warning before dying :(
--
___
Python
New submission from Gunnar Aastrand Grimnes:
When reading large files with fileinput, it will work as expected and only
process a line at a time when used normally, but if you add an hook_encoded
openhook it will read the whole file into memory before returning the first
line.
Verify by
Gunnar Aastrand Grimnes added the comment:
The problem lies in codecs.py here:
http://hg.python.org/cpython/file/ae7facd874ba/Lib/codecs.py#l581
--
___
Python tracker
<http://bugs.python.org/issue20
Gunnar Aastrand Grimnes added the comment:
Agreed that a doc-fix is the first step.
Shall I make another issue for the fix in fileinput?
I also wonder if the comment in codecs is not too negative - it is not easy to
get it 100% right, but the method just above readlines is readline, which
New submission from Gunnar Aastrand Grimnes:
When reading large files with fileinput, it will work as expected and only
process a line at a time when used normally, but if you add an hook_encoded
openhook it will read the whole file into memory before returning the first
line.
Verify by