Re: [Python-Dev] FileCookieJars

2013-03-10 Thread R. David Murray
On Sat, 09 Mar 2013 12:13:54 +1100, Steven D'Aprano  wrote:
> On 02/03/13 02:43, Demian Brecht wrote:
> > Cross-posting from python-ideas due to no response there. Perhaps it's
> > due to a general lack of usage/caring for cookiejar, but figured
> > /someone/'s got to have an opinion about my proposal ;)
> 
> Apparently not :-(
> 
> 
> > TL;DR: CookieJar > FileCookieJar > *CookieJar are architecturally
> > broken and this is an attempt to rectify that (and fix a couple bugs
> > along the way).
> [...]
> > This will obviously break backwards compatibility, so I'm not entirely
> > sure what best practice is around that: leave well enough alone even
> > though it might not make sense, keep the old implementations around
> > and deprecate them to be eventually replaced by the processors, or
> > other ideas?
> 
> I don't have an opinion on cookiejars per se, but I think that the first
> thing to do is get an idea of just how major a backward-compatibility
> breakage this would be. If you change the cookiejar architecture, then
> run the Python test suite, what happens? The number of failures will give
> you an idea of how bad it will be.
> 
> If there are no failures, you could consider just making the change. You
> probably should make an attempt to find out what third party apps use the
> cookiejars and see what they do.

To be clear, just passing the stdlib tests is *not* sufficient to think
that backward compatibility is not likely to be broken.  Deciding about
the likelihood of breakage is a hard problem, to which we generally
employ gut-level heuristics :) (And code search, as Steven suggests).

Since you say that it will "obviously" break backward compatibility, I'd
say that if we are going to do anything we'd have to think about how best
to introduce a more sane implementation and deprecate the old...and if we
are going to do that, we probably ought to spend a bit of time seeing if
there are any other open cookiejar issues we can tackle at the same time.

If, that is, you are interested enough to continue to be the point person
for this, which probably won't be a short process :)

The problem here is getting people interested, apparently :(

Since I start my Pycon diversion-from-work next week, maybe I can find
some time to take at least a preliminary look.

--David
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] FileCookieJars

2013-03-10 Thread Terry Reedy

On 3/10/2013 4:59 PM, R. David Murray wrote:


To be clear, just passing the stdlib tests is *not* sufficient to think
that backward compatibility is not likely to be broken.  Deciding about
the likelihood of breakage is a hard problem, to which we generally
employ gut-level heuristics :) (And code search, as Steven suggests).

Since you say that it will "obviously" break backward compatibility, I'd
say that if we are going to do anything we'd have to think about how best
to introduce a more sane implementation and deprecate the old...and if we
are going to do that, we probably ought to spend a bit of time seeing if
there are any other open cookiejar issues we can tackle at the same time.


A) For similar reasons, I consider the proposal a first draft, and 
probably not the exact right thing to do.
B) I have had similar thoughts about taking a broader look. Searching 
open issues for cookie gets 24 hits and I think at least half are about 
cookie.py or cookiejar.py.



If, that is, you are interested enough to continue to be the point person
for this, which probably won't be a short process :)

The problem here is getting people interested, apparently :(


The number of relatively recent problem reports indicates that people 
are using the two modules, so fixing them is worthwhile in that sense.


On the other no, it does not seem that any *current* developers are 
working with cookies.


Messages on http://bugs.python.org/issue17340 suggest that cookie.py 
should be based on http://tools.ietf.org/html/rfc6265

I added you as nosy to get your opinion.


Since I start my Pycon diversion-from-work next week, maybe I can find
some time to take at least a preliminary look.


I am willing to learn and help, but my only experience with them is as a 
browser user defending against the onslaught of cookies. (I once sped up 
IExplorer by deleting a massive cookie cache.)


--
Terry Jan Reedy

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] [Python-checkins] cpython: Issue #17385: Fix quadratic behavior in threading.Condition

2013-03-10 Thread Ezio Melotti
Hi,

On Mon, Mar 11, 2013 at 2:58 AM, raymond.hettinger
 wrote:
> http://hg.python.org/cpython/rev/0f86b51f8f8b
> changeset:   82592:0f86b51f8f8b
> user:Raymond Hettinger 
> date:Sun Mar 10 17:57:28 2013 -0700
> summary:
>   Issue #17385: Fix quadratic behavior in threading.Condition
>
> files:
>   Lib/threading.py |  10 --
>   Misc/NEWS|   3 +++
>   2 files changed, 11 insertions(+), 2 deletions(-)
>
>
> diff --git a/Lib/threading.py b/Lib/threading.py
> --- a/Lib/threading.py
> +++ b/Lib/threading.py
> @@ -10,6 +10,12 @@
>  from time import time as _time
>  from traceback import format_exc as _format_exc
>  from _weakrefset import WeakSet
> +try:
> +from _itertools import islice as _slice
> +from _collections import deque as _deque
> +except ImportError:
> +from itertools import islice as _islice
> +from collections import deque as _deque
>

Shouldn't the one in the 'try' be _islice too?

Best Regards,
Ezio Melotti
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] FileCookieJars

2013-03-10 Thread Demian Brecht

On 2013-03-10 1:59 PM, R. David Murray wrote:

To be clear, just passing the stdlib tests is*not*  sufficient to think
that backward compatibility is not likely to be broken.  Deciding about
the likelihood of breakage is a hard problem, to which we generally
employ gut-level heuristics:)  (And code search, as Steven suggests).


I figured that this would be a hard problem, which is also why I didn't 
delve into a patch further than a proposed first stab at a more sane 
implementation, coupled with changes to the unit tests.



Since you say that it will "obviously" break backward compatibility, I'd
say that if we are going to do anything we'd have to think about how best
to introduce a more sane implementation and deprecate the old...and if we
are going to do that, we probably ought to spend a bit of time seeing if
there are any other open cookiejar issues we can tackle at the same time.


I was hoping that there would be a little more interest (and potentially 
some further historical context on why the module was implemented as it 
was) from those in the group.



If, that is, you are interested enough to continue to be the point person
for this, which probably won't be a short process:)


I'm not sure who this was directed to (me or Steven), but I was looking 
for an area in the stdlib that I could really sink my teeth into and get 
my hands dirty with and this definitely seems to be just that. I figured 
that it wouldn't be a short process and the more that I read up on RFC 
6265 (and 2965) and compare them to the implementation in cookie and 
cookiejar, the more I'm thinking that this will be a relatively complex 
and lengthy process. (Definitely interested in that btw :)).




The problem here is getting people interested, apparently:(

Since I start my Pycon diversion-from-work next week, maybe I can find
some time to take at least a preliminary look.


In case you haven't already seen it, I had posted a second patch (that 
doesn't break the Liskov substitution principle as Terry pointed out 
after reviewing my overzealous initial patch) here: 
http://bugs.python.org/issue16901. I think the design is much more sane 
than what's currently there and aligns with how HTTP cookies are 
processed in urllib.request.


Now having said all that, the more I think about it and the more I read, 
the more I wonder why there are even specialized implementations (LWP 
and Mozilla) in the stdlib to begin with. I would assume that the only 
thing that the stdlib /should/ be covering is the RFC (6265, but still 
allowing 2965).


If there are deviations (and some are eluded to throughout the code), 
then I would think that those should be handled by packages external to 
the stdlib. It seems that the Mozilla implementation covers 2965, but 
LWP is based on the Perl library (which isn't known to be supported by 
any browser environment). Why is this even there to begin with? To 
paraphrase the comments that I read in the code: "This isn't supported 
by any browser, but they're easy to parse". In my mind, this shouldn't 
be reason enough for inclusion in the stdlib.


I'd also go as far to say that if cookies are implemented as 
consistently as, say, OAuth 2.0 providers (meaning very little to no 
consistency), then there really shouldn't be a cookie implementation in 
the stdlib anyway.


So to sum it up, yes I'm very much interested in doing what I can to 
help the development of the stdlib (more so interested in parts that 
don't currently have experts listed, such as http and imaplib), but will 
definitely need to be shown the ropes a bit as my professional life has 
revolved around closed source games.

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] FileCookieJars

2013-03-10 Thread Demian Brecht

On 2013-03-10 2:36 PM, Terry Reedy wrote:

A) For similar reasons, I consider the proposal a first draft, and
probably not the exact right thing to do.


That is correct. The more I think about it, the more I'm convincing 
myself that even though the proposal is more sane than what's there 
right now, it's definitely not the exact correct thing to do.

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com