[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-12-01 Thread Stephen Rosen
Stephen Rosen added the comment: Probably >90% of the use-cases for chaining classmethod are a read-only class property. It's important enough that some tools (e.g. sphinx) even have special-cased support for classmethod(property(...)). Perhaps the general case of classmethod(descrip

[issue43972] Simple HTTP Request Handler in http.server does not set a content-length and does not close connections on 301s

2021-05-06 Thread Stephen Rosen
Stephen Rosen added the comment: Thanks for working with me to reproduce and understand the issue. I'm a little surprised that with the sample which sets the protocol version you're still not seeing the issue. If I create a directory tree, e.g. repro ├── foo/ └── server.py where `server.py

[issue43972] Simple HTTP Request Handler in http.server does not set a content-length and does not close connections on 301s

2021-05-01 Thread Stephen Rosen
Stephen Rosen added the comment: Ach! Sorry! I didn't even realize this but the issue only arises when you are modifying the handler to set the protocol to HTTP/1.1 . In HTTP/1.0 , there's no notion of persistent connections, so the issue does not arise. But when the protocol version

[issue43972] Simple HTTP Request Handler in http.server does not set a content-length and does not close connections on 301s

2021-04-28 Thread Stephen Rosen
Change by Stephen Rosen : -- keywords: +patch pull_requests: +24395 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25705 ___ Python tracker <https://bugs.python.org/issu

[issue43972] Simple HTTP Request Handler in http.server does not set a content-length and does not close connections on 301s

2021-04-28 Thread Stephen Rosen
New submission from Stephen Rosen : If you use the `http.server` simple server and handler to serve a directory, navigating to a directory name without a trailing slash will trigger a 301 to add the trailing slash. For example, if "foo/" is a directory under the file server, a GET

Re: Bulletproof json.dump?

2020-07-07 Thread Stephen Rosen
On Mon, Jul 6, 2020 at 6:37 AM Adam Funk wrote: > Is there a "bulletproof" version of json.dump somewhere that will > convert bytes to str, any other iterables to list, etc., so you can > just get your data into a file & keep working? > Is the data only being read by python programs? If so,

How to handle async and inheritance?

2020-06-30 Thread Stephen Rosen
Hi all, I'm looking at a conflict between code sharing via inheritance and async usage. I would greatly appreciate any guidance, ideas, or best practices which might help. I'll speak here in terms of a toy example, but, if anyone wants to look at the real code, I'm working on webargs. [1]

Re: How to test?

2020-06-20 Thread Stephen Rosen
Worth noting: by assertTrue he probably meant assertEqual. But I'd recommend using assertIn [1] if you're using unittest to check output written to stdout/stderr. That way, your tests are slightly more robust to changes in the exact output. pytest may also be helpful for this (or any!) type of

[issue1360] Queue.get() can't be interrupted with Ctrl-C unless timed out

2017-06-13 Thread Stephen Rosen
Stephen Rosen added the comment: Can a note be added to the Queue.get() documentation? This behavior has been known to be at least potentially confusing for a decade, and there's no mention of it in the documentation. -- nosy: +Stephen Rosen versions: +Python 2.7 -Python 2.5