[issue44255] strptime and week numbers without week days
New submission from Jaap van der Velde : When running: ``` datetime.strptime('2013 23', '%Y %W') ``` The result is `datetime.datetime(2013, 1, 1, 0, 0)`. When running: ``` datetime.strptime('2013 23 1', '%Y %W %w') ``` The result is `datetime.datetime(2013, 6, 10, 0, 0)`. It seems that `%W` is ignored, unless `%w` is also provided. But instead of throwing an error, a result is returned that is needlessly inaccurate. It could (and should?) return the first day of the week as a default, if an error is undesirable. Similar to: ``` datetime.strptime('2013 3', '%Y %m') ``` ------ components: Library (Lib) messages: 394611 nosy: Jaap van der Velde priority: normal severity: normal status: open title: strptime and week numbers without week days type: enhancement versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue44255> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28294] HTTPServer server.py assumes sys.stderr != None
New submission from Jaap van der Velde: On line 556 of server.py, the sys.stderr.write assumes that sys.stderr is assigned and not None. However, when developing Windows services using the pypiwin32 library (as an example), sys.stderr == None A workaround is to override the log_message method of the BaseHTTPRequestHandler, but it seems to me that the method should not assume the availability of stderr? -- components: Library (Lib) messages: 277593 nosy: grismar priority: normal severity: normal status: open title: HTTPServer server.py assumes sys.stderr != None type: behavior versions: Python 3.5 ___ Python tracker <http://bugs.python.org/issue28294> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28294] HTTPServer server.py assumes sys.stderr != None
Jaap van der Velde added the comment: Closing and not fixing is fair enough - I did not realize that this would be an issue that occurs in many places in stdlib. I realize this is not a help forum, so I will ask elsewhere to see if there's some way to redirect all of sys.stderr in scenarios like these (running a service), because tracking down an issue like this takes a lot of time and finding the issue buried in a standard library caught me off guard. -- ___ Python tracker <http://bugs.python.org/issue28294> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28294] HTTPServer server.py assumes sys.stderr != None
Jaap van der Velde added the comment: Breaking the API isn't good, but it will only break if log_message doesn't *receive* all messages, because that's what people who override it count on. If there's some way of detecting who called log_message, you could use the appropriate log level on logging without compromising the API. But the only way I see without changing the signature of log_message is through inspect functions like getouterframes and that seems way nastier than these functions merit... -- ___ Python tracker <http://bugs.python.org/issue28294> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com