[issue22833] The decode_header() function decodes raw part to bytes or str, depending on encoded part

2022-01-11 Thread Daniel Lenski
Change by Daniel Lenski : -- keywords: +patch pull_requests: +28748 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30548 ___ Python tracker <https://bugs.python.org/issu

[issue22833] The decode_header() function decodes raw part to bytes or str, depending on encoded part

2021-12-30 Thread Daniel Lenski
Daniel Lenski added the comment: Due to this bug, any user of this function in Python 3.0+ *already* has to be able to handle all of the following outputs in order to use it reliably: decode_header(...) -> [(str, None)] or decode_header(...) -> [(bytes, str)] or decode_

[issue22833] The decode_header() function decodes raw part to bytes or str, depending on encoded part

2021-12-30 Thread Daniel Lenski
Daniel Lenski added the comment: I recently ran into this bug as well. For those looking for a reliable workaround, here's an implementation of a 'decode_header_to_string' function which should Just Work™ in all possible cases: #!/usr/bin/python3 import email.header

[issue30238] 2to3 doesn't detect or fix Exception indexing

2021-10-20 Thread Daniel Lenski
Daniel Lenski added the comment: Why was this closed? As I wrote in a previous comment, this situation can be automatically identified and addressed via static analysis in the vastly-predominant case, where the Exception object is assigned via an `exception ... as exc:` clause

[issue30238] 2to3 doesn't detect or fix Exception indexing

2021-06-21 Thread Daniel Lenski
Daniel Lenski added the comment: > There is no way to know through static analysis that the subscript is on an > object of type exception. I think this should be closed as won't fix. In almost all cases, the variable in question will receive its value via `except ... as e:`.

[issue35829] datetime: parse "Z" timezone suffix in fromisoformat()

2021-01-19 Thread Daniel Lenski
Daniel Lenski added the comment: Like many others here, I've run into this issue because I'm trying to parse timestamps from JSON. (Specifically, I'm trying to parse timestamps from JSON serialization of Java POJOs and/or Kotlin data classes, as serialized by the Jackson serialization

[issue35829] datetime: parse "Z" timezone suffix in fromisoformat()

2021-01-19 Thread Daniel Lenski
Change by Daniel Lenski : -- nosy: +dlenski ___ Python tracker <https://bugs.python.org/issue35829> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue2190] MozillaCookieJar ignores HttpOnly cookies

2020-11-17 Thread Daniel Lenski
Daniel Lenski added the comment: This can be closed. -- ___ Python tracker <https://bugs.python.org/issue2190> ___ ___ Python-bugs-list mailing list Unsub

[issue2190] MozillaCookieJar ignores HttpOnly cookies

2020-11-15 Thread Daniel Lenski
Daniel Lenski added the comment: Issue #38976 is a duplicate of this one, and now closed by https://github.com/python/cpython/pull/17471 -- ___ Python tracker <https://bugs.python.org/issue2

[issue38976] Add support for HTTP Only flag in MozillaCookieJar

2020-11-15 Thread Daniel Lenski
Change by Daniel Lenski : -- pull_requests: +22196 pull_request: https://github.com/python/cpython/pull/22798 ___ Python tracker <https://bugs.python.org/issue38

[issue38976] Add support for HTTP Only flag in MozillaCookieJar

2020-11-15 Thread Daniel Lenski
Daniel Lenski added the comment: This issue is essentially a duplicate of the very-longstanding #2190. My PR (https://github.com/python/cpython/pull/22798) was submitted before this one, but this one was accepted and merged first. -- nosy: +dlenski

[issue2190] MozillaCookieJar ignores HttpOnly cookies

2020-10-22 Thread Daniel Lenski
Daniel Lenski added the comment: @terry.reedy, it looks like my PR just needs a core developer to review it. Would you mind taking a look? :-) https://github.com/python/cpython/pull/22798 -- ___ Python tracker <https://bugs.python.org/issue2

[issue2190] MozillaCookieJar ignores HttpOnly cookies

2020-10-19 Thread Daniel Lenski
Change by Daniel Lenski : -- title: MozillaCookieJar ignore HttpOnly cookies -> MozillaCookieJar ignores HttpOnly cookies ___ Python tracker <https://bugs.python.org/iss

[issue2190] MozillaCookieJar ignore HttpOnly cookies

2020-10-19 Thread Daniel Lenski
Daniel Lenski added the comment: I've got a patch that will address both loading and saving of "HTTP-only" cookies: https://github.com/python/cpython/compare/master...dlenski:patch-1 Testing/feedback before I submit as a PR would be very welcome. -- versions: +Python 3.

[issue2190] MozillaCookieJar ignore HttpOnly cookies

2020-04-27 Thread Daniel Lenski
Daniel Lenski added the comment: Also confused about why this was closed. This format is still frequently used. In the absence of a solution in the standard library, I'm using this kludge to strip the leading `#HttpOnly_`. from tempfile import NamedTemporaryFile from http.cookiejar

[issue30238] 2to3 doesn't detect or fix Exception indexing

2017-05-02 Thread Daniel Lenski
New submission from Daniel Lenski: Python 2.7 allows indexing an Exception object to access its args list. >>> e=Exception('foo','bar','baz') >>> assert e[0] is e.args[0] This doesn't work in 3.5: >>> e=Exception('foo','bar','baz') >>> e.args[0] 'foo' &g

[issue30155] Add ability to get/set tzinfo on datetime instances in C API

2017-04-24 Thread Daniel Lenski
Changes by Daniel Lenski <dlen...@gmail.com>: -- nosy: +dlenski ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30155> ___ __

[issue23129] sqlite3 COMMIT nested in SELECT returns unexpected results

2016-04-11 Thread Daniel Lenski
Daniel Lenski added the comment: I agree on the nastiness of this bug. It's been plaguing my production code for months and I had been at a loss to explain why I've been getting duplicate rows until I found this SO post: http://stackoverflow.com/questions/27624049/python-sqlite3-cursor

[issue1818] Add named tuple reader to CSV module

2015-02-10 Thread Daniel Lenski
Daniel Lenski added the comment: Here's the class I have been using for reading namedtuples from CSV files: from collections import namedtuple from itertools import imap import csv class CsvNamedTupleReader(object): __slots__ = ('_r', 'row', 'fieldnames') def

[issue13299] namedtuple row factory for sqlite3

2014-08-04 Thread Daniel Lenski
Daniel Lenski added the comment: Serhiy, 52 usec/loop doesn't seem like much overhead. This is not 52 usec per row fetched, but just 52 usec per cursor.execute(). An example where 1 row is fetched for each cursor would show this more clearly. The advantage of namedtuple is that it's a very

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2012-07-01 Thread Daniel Lenski
Daniel Lenski dlen...@gmail.com added the comment: Richard, I think the problem with this is that it spreads the non-portable or OS-dependent parts of the code over several places rather than concentrating them all in one place. After close_without_unlink(), what would happen when the context

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2012-06-30 Thread Daniel Lenski
Daniel Lenski dlen...@gmail.com added the comment: Davide, the @contextlib.contextmanager decorator effectively wraps the yield statement in the necessary glue so that everything prior to the yield statement occurs in the __enter__() method of the contextmanager, while everything subsequent

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2012-06-29 Thread Daniel Lenski
Changes by Daniel Lenski dlen...@gmail.com: -- nosy: +dlenski ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14243 ___ ___ Python-bugs-list mailing

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2012-06-29 Thread Daniel Lenski
Daniel Lenski dlen...@gmail.com added the comment: Tim Golden, My preferred solution would be to replace the binary delete argument of the current NamedTemporaryFile implementation with finer-grained options: delete=False # don't delete delete=True # delete after file

Re: Can you escape a % in string that will used for substitution

2007-10-22 Thread Daniel Lenski
On Thu, 18 Oct 2007 15:21:41 -0400, Gerard Brunick wrote: Is there a way to do: s = I like python %i%s of the time. print s % (99, %) without having to pass in %? Thanks, Gerard Just double-up the % sign, e.g. I like python %i%% of the time. --