Re: [Python-Dev] [Python-checkins] cpython: Handle a possible race condition
On Tue, May 1, 2012 at 10:35 AM, raymond.hettinger wrote: > http://hg.python.org/cpython/rev/b3aeaef6c315 > changeset: 76675:b3aeaef6c315 > user: Raymond Hettinger > date: Mon Apr 30 14:14:28 2012 -0700 > summary: > Handle a possible race condition > > files: > Lib/functools.py | 6 ++ > 1 files changed, 6 insertions(+), 0 deletions(-) > > > diff --git a/Lib/functools.py b/Lib/functools.py > --- a/Lib/functools.py > +++ b/Lib/functools.py > @@ -241,6 +241,12 @@ > return result > result = user_function(*args, **kwds) > with lock: > + if key in cache: > + # getting here means that this same key was added to > the > + # cache while the lock was released. since the link > + # update is already done, we need only return the > + # computed result and update the count of misses. > + pass > if currsize < maxsize: > # put result in a new link at the front of the queue > last = root[PREV] To get the desired effect, I believe you also need s/if currsize/elif currsize/ Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] The step command of pdb is broken
On 30.04.2012 18:09, Barry Warsaw wrote: On Apr 30, 2012, at 08:42 AM, Guido van Rossum wrote: IT would be good if the author of one of the pdb add-ons such as (I believe) pdb2 could comment on this bug. Maybe we should take this opportunity (Python 3.3) to consider adopting one of the pdb add-ons or borging the best of their bits into the stdlib? I think the same policies should apply that I want to see followed for any other inclusion into the stdlib: we shouldn't "adopt" any code that is not explicitly contributed, by it's author. That's not only the legal issues, but also the responsibility for the code. Otherwise, we end up with code that still nobody owns, and the out-of-core version still gets better support. Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] The step command of pdb is broken
On Mon, Apr 30, 2012 at 6:57 PM, Senthil Kumaran wrote: > Irrespective of this - Issue13183 seems to be an easy to verify bug in > 3.2 and 3.3. I think, it would most visible if you were to use a full > screen debugger and you will notice that the return call indicator has > jumped to the next statement (skipping return) when returning. I > guess, that's why Xavier (pyclewn author) noted it. The fix seems > fine too. > > I have just requested an additional info and this particular one could > be fixed. Thanks for your help on this issue Senthil. Xavier ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] The step command of pdb is broken
Senthil, if you can shepherd this patch to completion that would be great! On Mon, Apr 30, 2012 at 9:57 AM, Senthil Kumaran wrote: > On Mon, Apr 30, 2012 at 12:09:02PM -0400, Barry Warsaw wrote: >> Maybe we should take this opportunity (Python 3.3) to consider adopting one >> of >> the pdb add-ons or borging the best of their bits into the stdlib? > > Irrespective of this - Issue13183 seems to be an easy to verify bug in > 3.2 and 3.3. I think, it would most visible if you were to use a full > screen debugger and you will notice that the return call indicator has > jumped to the next statement (skipping return) when returning. I > guess, that's why Xavier (pyclewn author) noted it. The fix seems > fine too. > > I have just requested an additional info and this particular one could > be fixed. > > Thanks, > Senthil > > ___ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] The step command of pdb is broken
On Mon, Apr 30, 2012 at 12:09:02PM -0400, Barry Warsaw wrote: > Maybe we should take this opportunity (Python 3.3) to consider adopting one of > the pdb add-ons or borging the best of their bits into the stdlib? Irrespective of this - Issue13183 seems to be an easy to verify bug in 3.2 and 3.3. I think, it would most visible if you were to use a full screen debugger and you will notice that the return call indicator has jumped to the next statement (skipping return) when returning. I guess, that's why Xavier (pyclewn author) noted it. The fix seems fine too. I have just requested an additional info and this particular one could be fixed. Thanks, Senthil ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] The step command of pdb is broken
On Mon, Apr 30, 2012 at 9:09 AM, Barry Warsaw wrote: > On Apr 30, 2012, at 08:42 AM, Guido van Rossum wrote: > >>IT would be good if the author of one of the pdb add-ons such as (I >>believe) pdb2 could comment on this bug. > > Maybe we should take this opportunity (Python 3.3) to consider adopting one of > the pdb add-ons or borging the best of their bits into the stdlib? I thought we already took most of the useful bits of one of these... (Admitted I'm vague on details and haven't the time to research.) -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] The step command of pdb is broken
On Apr 30, 2012, at 08:42 AM, Guido van Rossum wrote: >IT would be good if the author of one of the pdb add-ons such as (I >believe) pdb2 could comment on this bug. Maybe we should take this opportunity (Python 3.3) to consider adopting one of the pdb add-ons or borging the best of their bits into the stdlib? -Barry ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] The step command of pdb is broken
IT would be good if the author of one of the pdb add-ons such as (I believe) pdb2 could comment on this bug. On Mon, Apr 30, 2012 at 3:31 AM, Xavier de Gaye wrote: > Issue http://bugs.python.org/issue13183 raises the point that the step > command of pdb is broken. This issue is 6 months old. A patch and test > case have been proposed. The 'Lifecycle of a Patch' at > http://docs.python.org/devguide/patch.html says > > If your patch has not received any notice from reviewers (i.e., no > comment made) after a substantial amount of time then you may email > python-dev@python.org asking for someone to take a look at your patch. > > I am the author of pyclewn, a Vim front end to pdb and gdb, and I > would be grateful for any progress on this issue. > > The following pdb session shows the problem when running the three > modules main.py, foo.py and bar.py. After the second step command, pdb > does not stop (as it should) at lines foo.py:5 and foo.py:6, nor does > it stop to print the return value of increment(). > = > main.py > 1 import foo > 2 > 3 result = foo.increment(100) > 4 print('result', result) > foo.py > 1 import bar > 2 > 3 def increment(arg): > 4 v = bar.value() > 5 result = arg + v > 6 return result > bar.py > 1 def value(): > 2 return 5 > = > $ python -m pdb main.py >> /path_to/main.py(1)() > -> import foo > (Pdb) import sys; sys.version > '3.3.0a2+ (default:2c27093fd11f, Apr 30 2012, 10:51:35) \n[GCC 4.3.2]' > (Pdb) break bar.py:2 > Breakpoint 1 at /path_to/bar.py:2 > (Pdb) continue >> /path_to/bar.py(2)value() > -> return 5 > (Pdb) step > --Return-- >> /path_to/bar.py(2)value()->5 > -> return 5 > (Pdb) step >> /path_to/main.py(4)() > -> print('result', result) > (Pdb) > = > > > Xavier > ___ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org 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 (3.2): #14236: fix docs for \S.
On Sun, Apr 29, 2012 at 12:37:25PM +0200, ezio.melotti wrote: > range of Unicode whitespace characters. > -\S Matches any non-whitespace character; equiv. to [^ \t\n\r\f\v]. > +\S Matches any non-whitespace character; equivalent to [^\s]. Is this correct? While I understand what meant (or implied) \s is not a valid ascii character in the documentation we denoted the sets using ascii characters only. -- Senthil ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] suggestion regarding the contributor agreement form
Hi, It's not very obvious that printing this page http://www.python.org/psf/contrib/contrib-form/ actually prints only the form. Can you rather offer a downloadable image/pdf. As an aside, on Chromium, it appears on 2 separate pages, when there's enough space on the first. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] time.clock_info() field names
On 30Apr2012 09:26, Mark Shannon wrote: | monotonic is an adjective, Yes. | whereas adjusted is (part of) a verb. No. It is an adjective. | I think | both should be adjectives. Does "adjusted" mean that it has been | adjusted, that it can be adjusted or it will be adjusted? That depends on context. Reach for the doco. Of course, in the context of the PEP means "may be adjusted by exterior clock maintenance like NTP, and in fact this may have already happened". I am unhappy with that filled with underscores and used as the name:-( Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ Experience is what you get when you don't get what you want. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] time.clock_info() field names
On 29Apr2012 21:31, Benjamin Peterson wrote: | 2012/4/29 Jim J. Jewett : | > In http://mail.python.org/pipermail/python-dev/2012-April/119134.html | > Benjamin Peterson wrote: | > | >> I see PEP 418 gives time.clock_info() two boolean fields named | >> "is_monotonic" and "is_adjusted". I think the "is_" is unnecessary and | >> a bit ugly, and they could just be renamed "monotonic" and "adjusted". | > | > I agree with monotonic, but I think it should be "adjustable". | | I don't really care, but I think "adjusted" is fine. As in "this clock | is adjusted (occasionally)". -1 on "adjustable". That suggests the user can adjust it, not that the OS may adjust it. +1 on "adjusted" over "is_adjusted". -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ Winter is gods' way of telling us to polish. - Peter Harper ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] cpython: Issue #14428: Use the new time.perf_counter() and time.process_time() functions
On 29.04.2012 03:04, victor.stinner wrote: > http://hg.python.org/cpython/rev/bd195749c0a2 > changeset: 76599:bd195749c0a2 > user:Victor Stinner > date:Sun Apr 29 03:01:20 2012 +0200 > summary: > Issue #14428: Use the new time.perf_counter() and time.process_time() > functions [...] > diff --git a/Lib/timeit.py b/Lib/timeit.py > --- a/Lib/timeit.py > +++ b/Lib/timeit.py > @@ -15,8 +15,8 @@ >-n/--number N: how many times to execute 'statement' (default: see below) >-r/--repeat N: how many times to repeat the timer (default 3) >-s/--setup S: statement to be executed once initially (default 'pass') > - -t/--time: use time.time() (default on Unix) > - -c/--clock: use time.clock() (default on Windows) > + -t/--time: use time.time() > + -c/--clock: use time.clock() Does it make sense to keep the options this way? IMO the distinction should be to use either perf_counter() or process_time(), and the options could implement this (-t -> perf_counter, -c -> process_time). Georg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] The step command of pdb is broken
Issue http://bugs.python.org/issue13183 raises the point that the step command of pdb is broken. This issue is 6 months old. A patch and test case have been proposed. The 'Lifecycle of a Patch' at http://docs.python.org/devguide/patch.html says If your patch has not received any notice from reviewers (i.e., no comment made) after a substantial amount of time then you may email python-dev@python.org asking for someone to take a look at your patch. I am the author of pyclewn, a Vim front end to pdb and gdb, and I would be grateful for any progress on this issue. The following pdb session shows the problem when running the three modules main.py, foo.py and bar.py. After the second step command, pdb does not stop (as it should) at lines foo.py:5 and foo.py:6, nor does it stop to print the return value of increment(). = main.py 1 import foo 2 3 result = foo.increment(100) 4 print('result', result) foo.py 1 import bar 2 3 def increment(arg): 4 v = bar.value() 5 result = arg + v 6 return result bar.py 1 def value(): 2 return 5 = $ python -m pdb main.py > /path_to/main.py(1)() -> import foo (Pdb) import sys; sys.version '3.3.0a2+ (default:2c27093fd11f, Apr 30 2012, 10:51:35) \n[GCC 4.3.2]' (Pdb) break bar.py:2 Breakpoint 1 at /path_to/bar.py:2 (Pdb) continue > /path_to/bar.py(2)value() -> return 5 (Pdb) step --Return-- > /path_to/bar.py(2)value()->5 -> return 5 (Pdb) step > /path_to/main.py(4)() -> print('result', result) (Pdb) = Xavier ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] time.clock_info() field names
Benjamin Peterson wrote: 2012/4/29 Jim J. Jewett : In http://mail.python.org/pipermail/python-dev/2012-April/119134.html Benjamin Peterson wrote: I see PEP 418 gives time.clock_info() two boolean fields named "is_monotonic" and "is_adjusted". I think the "is_" is unnecessary and a bit ugly, and they could just be renamed "monotonic" and "adjusted". I agree with monotonic, but I think it should be "adjustable". I don't really care, but I think "adjusted" is fine. As in "this clock is adjusted (occasionally)". monotonic is an adjective, whereas adjusted is (part of) a verb. I think both should be adjectives. Does "adjusted" mean that it has been adjusted, that it can be adjusted or it will be adjusted? Cheers, Mark. ___ Python-Dev mailing list Python-Dev@python.org 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] devguide: Record Richard Oudkerk.
> +- Richard Oudkerk was given push privileges on Apr 29 2012 by Antoine Pitrou > + on recommendation by Charles-François Natali and Jesse Noller, for various > + contributions to multiprocessing (and original authorship of > + multiprocessing's predecessor, the processing package). Could one of you (Antoine, Charles-Francois, or Jesse) ask Richard to subscribe to python-committers? Or if you're reading this, Richard, could you subscribe? It's at http://mail.python.org/mailman/listinfo/python-committers I think there may have been some other recent committers for whom I didn't see subscribe requests, but I don't track it all that closely. Eric. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com