[issue29298] argparse fails with required subparsers, un-named dest, and empty argv
Paulie Pena added the comment: I'd like to second this idea, since it's very confusing without it: > while waiting for a fix, would it be possible to document in the argparse > documentation that the 'dest' parameter is required (at least temporarily) > for add_subparsers()? (somewhere near > file:///usr/share/doc/python/html/library/argparse.html#sub-commands) -- nosy: +paulie4 ___ Python tracker <https://bugs.python.org/issue29298> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42256] BaseCookie.__parse_string() doesn't work with expires= between cookies
Paulie Pena added the comment: Here's a simple example. This is correctly parsed via a `SimpleCookie().load()` call: 'key1=val1, key2=val2' but this fails to parse: 'key1=val1; expires=Wed, 21 Oct 2015 07:28:00 GMT, key2=val2' My suggested fix: str = re.sub(r'(=\w{3},\s[\w\d\s-]{9,11}\s[\d:]{8}\sGMT),', r'\1;', str) will convert the comma separator to a semicolon, so this will correctly parse: 'key1=val1; expires=Wed, 21 Oct 2015 07:28:00 GMT; key2=val2' -- ___ Python tracker <https://bugs.python.org/issue42256> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42256] BaseCookie.__parse_string() doesn't work with expires= between cookies
Paulie Pena added the comment: whoops, the first string should also be a raw string, i.e. `r'...'` -- ___ Python tracker <https://bugs.python.org/issue42256> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42256] BaseCookie.__parse_string() doesn't work with expires= between cookies
New submission from Paulie Pena : Since `requests` creates a comma-separated list for any duplicated headers, this causes a problem when `expires=...` is between two `Set-Cookie` header values. `BaseCookie.__parse_string()` in https://github.com/python/cpython/blob/master/Lib/http/cookies.py, in that case, will just give up, since it thinks it was given an invalid cookie. The fix is to replace the comma at the end of each trailing `expires=...` with a semicolon. Inside `BaseCookie.__parse_string()`, before the `while` loop, all that should be needed is to add this: ``` str = re.sub('(=\w{3},\s[\w\d\s-]{9,11}\s[\d:]{8}\sGMT),', r'\1;', str) ``` -- components: Library (Lib) messages: 380294 nosy: paulie4 priority: normal severity: normal status: open title: BaseCookie.__parse_string() doesn't work with expires= between cookies type: behavior versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue42256> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29871] Enable optimized locks on Windows
Change by Paulie Pena : -- nosy: +paulie4 ___ Python tracker <https://bugs.python.org/issue29871> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12966] cookielib.LWPCookieJar breaks on cookie values with a newline
Paulie Pena paul...@gmail.com added the comment: RFC 2109's Section 4.1 Syntax: General (http://www.ietf.org/rfc/rfc2109.txt) states that the attributes and values should be tokens, which the define as (informally, a sequence of non-special, non-white space characters) from the HTTP/1.1 specification [RFC 2068]. The one site that had sent me a cookie with a newline in a value is no longer doing that, but of course, there could be other sites with buggy code for sending cookies. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12966 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12966] cookielib.LWPCookieJar breaks on cookie values with a newline
Paulie Pena paul...@gmail.com added the comment: Sorry, by crash I did mean that it raised an exception. My program wasn't expecting cookielib to fail while reading a cookie file that it had written, so I didn't wrap the code to read the cookie file in a try..except. I would imagine that most people wouldn't. Do you agree? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12966 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12966] cookielib.LWPCookieJar breaks on cookie values with a newline
Paulie Pena paul...@gmail.com added the comment: OK, I'll wrap it in a try-except. Do you think the documentation should updated to make users aware of this possible problem? Thanks, Paulie -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12966 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12966] cookielib.LWPCookieJar breaks on cookie values with a newline
New submission from Paulie Pena paul...@gmail.com: Even though RFC 6265's cookie-value's cookie-octet definition says that whitespace characters are not allowed (see http://tools.ietf.org/html/rfc6265), there are non-compliant web sites that send cookie values with newlines. cookielib.LWPCookieJar will save the bad value in a cookie file, but when it tries to load it, it probably is only splitting by newlines, so it crashes on the invalid line. The easiest thing would probably be to just ignore cookies that have values with a newline. (Note: I'm using Python 2.5, so this might have been fixed in a later version.) -- components: Library (Lib) messages: 143928 nosy: paulie4 priority: normal severity: normal status: open title: cookielib.LWPCookieJar breaks on cookie values with a newline type: behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12966 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com