Martin Panter added the comment:
Maybe it would be better to redefine the docstring to say it flushes the codec
as well as calling flush() on the underlying stream.
But if you really want to finish the job you should probably be closing the
underlying stream, which would flush if necessary
Martin Panter added the comment:
Here is a patch to implement the zlib-codec and bz2-codec StreamWriter classes
based on their IncrementalEncoder classes. It depends on my patch for Issue
23231, though I guess it could be tweaked to work around that if desired.
--
keywords: +patch
Martin Panter added the comment:
A different test case for “unused_data” attribute was added in 2012 for Issue
16350, so that part is no longer needed.
If this feature goes ahead, it might be nice to also update the bzip and LZMA
modules for consistency.
In Python 3, the equivalent of the
Martin Panter added the comment:
New patch that also fixes StreamWriter.writelines() in general for the byte
codecs
--
Added file: http://bugs.python.org/file37710/zlib-bz2-writer.v2.patch
___
Python tracker
<http://bugs.python.org/issue13
Martin Panter added the comment:
What about instead of
'''
Whether changes to one are reflected in the other after the call returns is
undefined; additionally, the dictionary may change unpredictably after the
call, and how it does is implementation-specific.
''
Martin Panter added the comment:
For the record, this is related to PEP 455 (key-transforming dictionary)
--
nosy: +vadmium
___
Python tracker
<http://bugs.python.org/issue18
Martin Panter added the comment:
I opened Issue 23231 about fixing iterencode() and iterdecode() in the general
case. I added a patch to Issue 13881 to fix StreamWriter for zlib and bz2, and
to fix StreamWriter.writelines() in general.
I am adding a patch here to clarify the StreamReader API
Martin Panter added the comment:
Sorry, I changed the name of the attribute and forgot to update the doc string.
Its new name was _Encoder.
Your description was fairly accurate. I am adding patch v3, with an expanded
the doc string. Hopefully that explains it a bit better. Since it is just
Martin Panter added the comment:
My “master plan” is basically to make most of the bytes-to-bytes codecs work as
documented in the incremental (stateful) modes. I’m less interested in fixing
the text codecs, and the quopri and uu codecs might be too hard, so I was going
to propose some
Martin Panter added the comment:
I believe the BadStatusLine can still happen, depending on the circumstances.
When I get a chance I will see if I can make a demonstration. In the meantime
these comments from my persistent connection handler
<https://github.com/vadmium/python-iview/b
New submission from Martin Panter:
$ python3 -c 'import codecs; from io import BytesIO;
codecs.getwriter("big5")(BytesIO()).reset()'
Segmentation fault (core dumped)
[Exit 139]
Happens for all the multibyte codecs:
broken_stream_codecs = {
"big5", "b
Martin Panter added the comment:
There is a flaw with inheriting the readline() method in my patch, and I have
decided to give up fixing the StreamReader classes. I did update the
documentation in my copy of the patch based on Marc-Andre Lemburg’s feedback if
anyone is interested in it
Martin Panter added the comment:
There is also a new sentence about the GIL at the end, but leaving the
inbetween lines as they were would verify this
--
nosy: +vadmium
___
Python tracker
<http://bugs.python.org/issue23
Martin Panter added the comment:
What I have sometimes done in this situation is just break the overly long line
into two short lines
--
___
Python tracker
<http://bugs.python.org/issue23
Martin Panter added the comment:
The post makes a bit more sense once you realize the dotted numbers refer to
old section numbers (which have moved on now):
20.19.2 → “Server Objects” section
20.19.1 → “Server Creation Notes”
Regarding point 2: Instructions for the user to make a threading or
Changes by Martin Panter :
--
nosy: +vadmium
___
Python tracker
<http://bugs.python.org/issue14307>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Martin Panter :
--
title: FD leak in SocketServer -> FD leak in SocketServer when request handler
throws exception
___
Python tracker
<http://bugs.python.org/iss
Changes by Martin Panter :
--
nosy: +vadmium
___
Python tracker
<http://bugs.python.org/issue13354>
___
___
Python-bugs-list mailing list
Unsubscribe:
Martin Panter added the comment:
Adding issue15955_lzma_r5.diff. Main changes from r4:
* Consistent Py_ssize_t type for data_size
* max_size → max_length to match Python parameter name
* Arranged for EOF handling to occur before, and instead of, saving the input
buffer
* Removed my LZMAFile
New submission from Martin Panter:
Running the example from the Asynchronous Mixins section of the “socketserver”
documentation generates a ResourceWarning:
$ ./python -btWall ThreadedTCPServer.py
Server loop running in thread: Thread-1
Received: Thread-2: Hello World 1
Received: Thread-3
Martin Panter added the comment:
Okay here is a demonstration script, which does two tests: a short basic GET
request, and a 2 MB POST request. Output for me is usually:
Platform: Linux-3.15.5-2-ARCH-x86_64-with-arch
Normal request: getresponse() raised BadStatusLine("''&
Martin Panter added the comment:
For what it’s worth, both io.TextIOWrapper and _pyio.TextIOWrapper appear to
only ever call IncrementalEncoder.setstate(0). And the newline _decoder_ is not
relevant because it doesn’t use any _encoder_.
--
nosy: +vadmium
Changes by Martin Panter :
--
nosy: +vadmium
___
Python tracker
<http://bugs.python.org/issue23255>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Martin Panter :
--
nosy: +vadmium
___
Python tracker
<http://bugs.python.org/issue18022>
___
___
Python-bugs-list mailing list
Unsubscribe:
Martin Panter added the comment:
Another idea that doesn’t involve changing the incremental codec APIs is kind
of described in <https://bugs.python.org/issue7475#msg145986>: to add format
parameters to iterencode() and iterdecode(), which would allow it to determine
the right data t
Martin Panter added the comment:
Here is a patch that clarifies in the documentation and test suite how newlines
work in the “quopri” and “binascii” modules. It also fixes the native Python
implementation to support CRLFs.
* \n is used by default (e.g. for soft line breaks if the input has no
Martin Panter added the comment:
Spotted code in Python’s own library that maintains a persistent connection and
works around this issue:
Lib/xmlrpc/client.py:1142
--
___
Python tracker
<http://bugs.python.org/issue3
Martin Panter added the comment:
I would support adding ENOTCONN under the ConnectionError umbrella. It is
caught for shutdown() calls in a few standard library modules. Here is a demo
showing how to trigger it (at least on Linux):
from socket import create_connection, SHUT_RDWR
from
Martin Panter added the comment:
Three slightly different points here:
1. Decoding trailing whitespace: My understanding is quoted-printable encoding
aims to be tolerant of whitespace being added to and removed from the end of
encoded lines. So I assume the “binascii” module is wrong to leave
Martin Panter added the comment:
Personally I don’t have a problem with the names; I would consider str(),
bytes(), bytearray() types all to be “strings”. However there is precedent in
the “base64” module for renaming to en/decodebytes(); see Issue 3613.
--
nosy: +vadmium
Martin Panter added the comment:
Is this patch likely to go ahead? It has been sitting around a while and would
conflict with patches I am working on.
If so, I reckon it would be good to factor out some of the new bits of code
(_check_strict, _StrictErrors) into a common place, like the
Martin Panter added the comment:
Regarding decoding trailing whitespace,
<https://tools.ietf.org/html/rfc1521.html#section-5.1> rule #3 says:
“When decoding a Quoted-Printable body, any trailing white space on a line must
be deleted, as it will necessarily have been added by interm
Martin Panter added the comment:
Would also be good to document that errors='ignored' is not allowed. Currently
the documentation says
The following string values are defined and implemented by all standard Python
codecs:
* 'st
Martin Panter added the comment:
Hi Demian, my intention is to demonstrate normal usage of Python’s HTTP client,
whether or not its implementation misbehaves. I am trying to demonstrate a
valid persistent server that happens to decide to close the connection after
the first request but before
Martin Panter added the comment:
Calling self.wfile.write(b"") should be equivalent to not calling write() at
all, as far as I understand. Using strace, it does not seem to invoke send() at
all. So the result will depend on what is written next. In the case of my code,
nothing is wr
Martin Panter added the comment:
Here is patch v2, which fixes some more bugs I uncovered in the
quoted-printable encoders:
* The binascii version would unnecessarily break a 76-character line (maximum
length) if it would end with an =XX escape code
* The native Python version would insert
Martin Panter added the comment:
Just noticed the new documentation says “http.HTTPStatus.OK is also available
as . . . http.server.OK”. I think this is wrong; only the client module (and
now the top-level package) have those constants. The enum values are only
available in the server module
Martin Panter added the comment:
Yeah I’m happy to put a patch together, once I have an idea of the details.
I’d also like to understand your scenario that would mislead the user to
believe that the connection has been closed when it actually hasn’t. Can you
give a concrete example or
Martin Panter added the comment:
The Lib/xmlrpc/client.py file appears to already support compression using
“Content-Encoding: gzip”. Perhaps it could be leveraged for any work on this
issue.
--
___
Python tracker
<http://bugs.python.
Martin Panter added the comment:
But () is the odd one out if you consider
>>> [a, b] = range(2)
>>> [] = range(0)
>>> (a, b) = range(2)
>>> () = range(0)
File "", line 1
SyntaxError: can't assign to ()
--
nosy: +vadmium
__
Changes by Martin Panter :
--
nosy: +vadmium
___
Python tracker
<http://bugs.python.org/issue23302>
___
___
Python-bugs-list mailing list
Unsubscribe:
Martin Panter added the comment:
Here is a patch, including tests and documentation. It ended up a bit more
complicated than I anticipated, so I’m interested in hearing other ideas or
options.
* Added http.client.ConnectionClosed exception
* HTTPConnection.close() is implicitly called for a
Martin Panter added the comment:
The reference to @functools.total_ordering was actually already there; I just
moved it into the paragraph about relationships between the operators. I should
also point out that my description of the default __ne__() assumes that Issue
21408 is resolved; the
Martin Panter added the comment:
See Issue 3566 about tweaking the “http.client” module’s BadStatusLine handling
to be more helpful when implementing persistent connections. I am dumping some
thoughts here about persistent connections with the “http.client” module,
gained by working on that
Martin Panter added the comment:
Updated v2 patch. This version avoids intruding into the
HTTPConnection.connect() implementation, so that users, tests, etc may still
set the undocumented “sock” attribute without calling the base connect()
method. Also code style changes based on feedback to
Martin Panter added the comment:
I am certainly no expert, but this is how I understand the three different
kinds of codecs are used:
* Stateless codecs: str.encode(), bytes.decode(), etc
* Incremental codecs: TextIOWrapper, IncrementalNewlineDecoder
* Stream codecs: only stuff inside the
Martin Panter added the comment:
Here is a new patch which fixes the bytes-to-bytes incremental codecs. It
depends on my patches for these other issues being applied first:
* Issue 23231: Bytes-to-bytes support for iteren/decode()
* Issue 13881: Generic StreamWriter from IncrementalEncoder
Martin Panter added the comment:
I’m happy with the new wording in v5. Maybe the docstring in the C module could
be reflowed though.
--
___
Python tracker
<http://bugs.python.org/issue21
Martin Panter added the comment:
Here is patch v4. The stream writer is now automatically generated by default
by the CodecInfo constructor if no custom stream writer parameter is supplied.
The base64 and quopri codecs are adjusted to also use this default stream
writer to help with Issue
Changes by Martin Panter :
--
nosy: +vadmium
___
Python tracker
<http://bugs.python.org/issue17088>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Martin Panter :
--
nosy: +vadmium
___
Python tracker
<http://bugs.python.org/issue23320>
___
___
Python-bugs-list mailing list
Unsubscribe:
Martin Panter added the comment:
Adding a new patch that just fixes the typo error in the first patch
--
Added file:
http://bugs.python.org/file37859/default-ne-reflected-priority.v2.patch
___
Python tracker
<http://bugs.python.org/issue4
Martin Panter added the comment:
I looked over your __ne__ removals from the library, and they all seem sensible
to me.
--
___
Python tracker
<http://bugs.python.org/issue21
Martin Panter added the comment:
Thanks for the reviews.
I agree about the new HTTPResponse flag being a bit awkward; the HTTPResponse
class should probably raise the ConnectionClosed exception in all cases. I was
wondering if the the HTTPConnection class should wrap this in a
Changes by Martin Panter :
--
nosy: +vadmium
___
Python tracker
<http://bugs.python.org/issue14465>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Martin Panter :
--
nosy: +vadmium
___
Python tracker
<http://bugs.python.org/issue23334>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Martin Panter :
--
nosy: +vadmium
___
Python tracker
<http://bugs.python.org/issue23342>
___
___
Python-bugs-list mailing list
Unsubscribe:
Martin Panter added the comment:
Documenting the “headers” attribute is also discussed in Issue 12707
--
___
Python tracker
<http://bugs.python.org/issue22
Martin Panter added the comment:
Related: Issue 12707, about deprecating some methods in favour of attributes
--
___
Python tracker
<http://bugs.python.org/issue21
Martin Panter added the comment:
I think it would be okay to deprecate the methods in the documentation, but
they should not be removed nor trigger warnings any time soon.
Currently the following related methods and attributes are documented:
* addinfourl.getcode() == HTTPResponse.status
Martin Panter added the comment:
Blessing a geturl() method or “url” attribute on HTTPError might require Issue
13567 to be fixed
--
___
Python tracker
<http://bugs.python.org/issue12
Changes by Martin Panter :
--
nosy: +vadmium
___
Python tracker
<http://bugs.python.org/issue23350>
___
___
Python-bugs-list mailing list
Unsubscribe:
Martin Panter added the comment:
[Edit Error: 'utf8' codec can't decode byte 0xe2 in position 207: invalid
continuation byte]
The documentation currently says “Content-Length header should be explicitly
provided when the body is an iterable”. See Lib/urllib/request.py:1133 for
Martin Panter added the comment:
My experiments with buffered and unbuffered readers wrapping a non-blocking TCP
socket, with no data received:
Method Buffered impl. Buffered doc.SocketIO impl. RawIOBase doc
Martin Panter added the comment:
The non-blocking behaviour that I documented in my patch is under question in
Issue 13322. I think it would be nice change the implementation to either
return None or raise BlockingIOError.
--
___
Python tracker
Martin Panter added the comment:
Sorry my comment was a bit rushed. I wasn’t saying this feature shouldn’t be
added. I guess I was pointing out two things:
1. Someone should updated the documentation to say that Content-Length no
longer has to be explicitly provided for lists and tuples.
2
Martin Panter added the comment:
Nikolaus, do you still plan on doing the bzip module? If not, I could have a go
when I get a chance. I’m also keen for the GzipFile decompression to be fixed,
if anyone wants to review my gzip-bomb.patch
Martin Panter added the comment:
I looked at all the instances of __ne__() identified in the patch, and they all
seem redundant with the __eq__() implementations, so I think this patch is good.
--
___
Python tracker
<http://bugs.python.
Martin Panter added the comment:
Maybe you don’t want to touch the implementation of the “older high-level API”
for fear of subtly breaking something, but for clarification, and perhaps
documentation, would the old functions now be equivalent to this?
def call(***):
# Verify PIPE not in
New submission from Martin Panter:
This patch adds BaseServer to __all__. It also adds a test case that should
automatically fail if someone defines a new function or class in the
“socketserver” module and does not update __all__.
--
components: Library (Lib)
files: socketserver
Martin Panter added the comment:
Here is a simple patch to add server_close() to the documentation, and a simple
test to ensure it closes the socket.
--
keywords: +patch
versions: +Python 3.4, Python 3.5
Added file: http://bugs.python.org/file37940/server_close.patch
Martin Panter added the comment:
I have changed my opinion of the “peek hack” from
<https://bugs.python.org/issue3566#msg231413>. It would be useful when doing
non-idempotent requests like POST, to avoid sending a request when we know it
is going to fail. I looked into how to implement
Martin Panter added the comment:
It’s okay to leave them as independent classes, if you don’t want multiple
inheritance. I was just putting the idea out there. It is a similar pattern to
the HTTPError exception and HTTPResponse return value for urlopen
Martin Panter added the comment:
New test case looks good. Checking for the underscore prefix is how I would
have done it too, if I had realized it was needed :)
I’m not qualified to comment on removing the run_unittest() call.
--
___
Python
Martin Panter added the comment:
Here is an enhancement to the existing SimpleHTTPServerTestCase.test_get() test
case, that demonstrates the current implementation breaks serving index.html
files by default.
--
Added file: http://bugs.python.org/file37947/index-test.patch
Martin Panter added the comment:
I can live with the wording of StringIO, but personally prefer my v2 patch. I
now understand that calling close() for Bytes and StringIO objects is intended
to immediately free the memory buffer holding the file data (like deleting a
file in Windows). So I
Martin Panter added the comment:
Here is a 4th patch that allows None as input. Other changes:
* Document and test getdoc() returning None
* Limited the splitting and re-joining dance
* Document when the synopsis and body strings are empty
* More test cases
I left the pydoc test there, though
Changes by Martin Panter :
Removed file: http://bugs.python.org/file37948/issue12916-splitdoc-4.patch
___
Python tracker
<http://bugs.python.org/issue12916>
___
___
Pytho
Martin Panter added the comment:
Oops, seems I forgot to refresh my patch
--
Added file: http://bugs.python.org/file37949/issue12916-splitdoc-4.patch
___
Python tracker
<http://bugs.python.org/issue12
Martin Panter added the comment:
Here is an attempt to tidy up the socketserver documentation:
1. Added headings for each concrete class and mixin
2. Listed the predefined mixin subclasses
3. Changed RequestHandler to BaseRequestHandler and added class heading
4. Included headings for
Martin Panter added the comment:
Here is another addition to the existing test suite to detect the bug with the
duplicate 404 Not Found responses. It relies on running the non-Windows,
non-root test that says
# chmod() doesn't work as expected on Windows, and filesystem
# permission
Martin Panter added the comment:
Uploading issue12916-splitdoc-5.patch:
* Documented TypeError
* Added stacklevel=2 to warning
* Test improvements
* Dropped the test for pydoc.splitdoc() removal
--
Added file: http://bugs.python.org/file37956/issue12916-splitdoc-5.patch
Martin Panter added the comment:
Main changes in socketserver-doc.2.patch:
* Documented constructor parameters for the server classes
* Indented class methods and attributes underneath class headings
--
Added file: http://bugs.python.org/file37957/socketserver-doc.2.patch
New submission from Martin Panter:
Currently the documentation gives the impression that the “data” parameter to
Request() has to be in the application/x-www-form-urlencoded format. However I
suspect that you can override the type by supplying a Content-Type header, and
I would like to
Martin Panter added the comment:
Yes, this is based on your patch, Stéphane. On top of it I added support for
splitdoc(None), and made the other changes in the bullet points.
--
___
Python tracker
<http://bugs.python.org/issue12
Martin Panter added the comment:
Maybe because a pager sends its bytes more-or-less straight throught from input
to output, the PYTHONIOENCODING (sys.stdout.encoding?) should be used for the
TextIOWrapper to the pager’s input in this case. I’m not so sure this should be
assumed in general
Martin Panter added the comment:
_CData.from_buffer() is meant to take a writable buffer, and create a “ctypes”
object that shares the same memory. So it should not release the buffer until
that “ctypes” object is no longer needed.
However I don’t know the insides of memoryview() objects that
Martin Panter added the comment:
Updated patch to explain that a Request object is generated internally for
urlopen(data=...), and added a test to confirm. Also removed some confusing
dead code.
--
Added file: http://bugs.python.org/file37972/non-urlencoded.2.patch
Martin Panter added the comment:
Here is an option that moves the documentation for discarding the buffer into
the class description for both BytesIO and StringIO; what do you think? I would
be happy enough with any of the last three patches, so I don’t want to hold
this up forever
Martin Panter added the comment:
You’re welcome to merge my test patch into yours if you want to. Or I could
open a separate issue for it, I don’t mind.
--
___
Python tracker
<http://bugs.python.org/issue23
Martin Panter added the comment:
Looking at test_io.BufferedReaderTest.test_read_non_blocking(), at
Lib/test/test_io.py:1037, there are explicit tests for ‘peek(1) == b"" ’ and
‘read() is None’. The peek() test was added in revision 3049ac17e256, in 2009
(large merge of “io” impleme
New submission from Martin Panter:
This is the same issue raised at <https://bugs.python.org/issue4879#msg91597>.
Currently, every time a new response is to be received, HTTPConnection passes
its raw socket object to HTTPResponse, which calls sock.makefile("rb") and
creates
Martin Panter added the comment:
Opened Issue 23377 for the problem of dropping extra buffered data at the end
of a response.
--
nosy: +vadmium
___
Python tracker
<http://bugs.python.org/issue4
Martin Panter added the comment:
Regarding the documentation patch: I like to start sentences with a capital
letter. Perhaps change it to start “Calling :func:`exit` only terminates . . .”.
With the code change patch, it might be neater to use the SystemExit.code
attribute rather than e.args
Martin Panter added the comment:
New patches look fine. BTW SystemExit.code is also documented at
<https://docs.python.org/dev/library/exceptions.html#SystemExit>.
--
___
Python tracker
<http://bugs.python.org/
Martin Panter added the comment:
I’m adding nonblock-none.patch, which changes all the simple buffered read
methods to return None when there is no non-blocking data available. I’d be
interested to see if other people thought this was a sensible change.
* Documented existing behaviour of C
Changes by Martin Panter :
--
nosy: +vadmium
___
Python tracker
<http://bugs.python.org/issue2786>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Martin Panter:
Seems to have been removed in revision 097f4fda61a4, for PEP 3151. The older
EnvironmentError documentation talks about creating the exception with two and
three constructor arguments, however I don’t see this in the new documentation.
Is this usage meant to
Martin Panter added the comment:
I changed “code point in the Unicode Private Use Area” to “individual surrogate
code” in the “codecs” module documentation for Issue 19548. So perhaps (a)
still needs addressing, but (b) and (c) are hopefully already fixed.
--
nosy: +vadmium
Changes by Martin Panter :
--
nosy: +vadmium
___
Python tracker
<http://bugs.python.org/issue23285>
___
___
Python-bugs-list mailing list
Unsubscribe:
1701 - 1800 of 4320 matches
Mail list logo