Re: [Python-Dev] [PEP 3148] futures - execute computations asynchronously

2010-03-11 Thread Brian Quinlan


On 10 Mar 2010, at 23:32, Nick Coghlan wrote:


Brian Quinlan wrote:

Getting rid of the process-global state like this simplifies testing
(both testing of the executors themselves and of application code
which uses them).  It also eliminates the unpleasant interpreter
shutdown/module globals interactions that have plagued a number of
stdlib systems that keep global state.


I'm not sure what you mean, could you clarify?


Assuming your question refers to the second sentence, Jean-Paul is
referring to a trick of the CPython interpreter when it terminates. To
maximise the chances of objects being deleted properly rather than  
just

dumped from memory when the process exits, module dictionaries are
filled with None values before the interpreter shuts down.

This can cause weirdness (usually intermittent name errors during
shutdown) when __del__ methods directly or indirectly reference module
globals.



Ah. I'm familiar with this problem. My approach was to install an exit  
handler that ensures that all pending futures are complete and all  
threads and processes exit before allowing the interpreter to exit.


Cheers,
Brian

One of the easiest ways to avoid that is to put the state on a  
singleton

object, then give the affected classes a reference to that object.

Cheers,
Nick.

P.S. This problem is actually the reason we don't have a context  
manager

for temporary directories yet. Something that should have been simple
became a twisty journey down the rabbit hole:
http://bugs.python.org/issue5178

--
Nick Coghlan   |   [email protected]   |   Brisbane, Australia
---
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/brian%40sweetapp.com


___
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


[Python-Dev] Bug tracker: no confirmation before deleting a message

2010-03-11 Thread Victor Stinner
Hi,

I removed two messages by error in the bug tracker :-(

The first message is msg100432 (first message of #8063) which has been 
restored by "admin". Thank you admin!

The second message is msg98284, part of #7774. How can I restore it? Or can 
"admin" restore it please? :-)

There is an open issue on Roundup tracker to add a button to restore a message 
or a deleted file:

  http://psf.upfronthosting.co.za/roundup/meta/issue267

I tried to following URL to restore the message, but it didn't work:

  http://bugs.python.org/issue80...@action=edit&@a...@messages=100432

Could you at least add a Javascript confirmation dialog please? :-)

-- 
Victor Stinner
http://www.haypocalc.com/
___
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] Bug tracker: no confirmation before deleting a message

2010-03-11 Thread Martin v. Löwis
> I removed two messages by error in the bug tracker :-(

Please discuss tracker issues on tracker-discuss or, better yet, file a
report on the meta tracker.

> The second message is msg98284, part of #7774. How can I restore it? Or can 
> "admin" restore it please? :-)

Done.

> There is an open issue on Roundup tracker to add a button to restore a 
> message 
> or a deleted file:
> 
>   http://psf.upfronthosting.co.za/roundup/meta/issue267

Unfortunately, I didn't have time to look into this yet (and may not for
many more weeks to come).

> I tried to following URL to restore the message, but it didn't work:
> 
>   http://bugs.python.org/issue80...@action=edit&@a...@messages=100432

Roundup has stopped accepting GET requests that edit the database, for
XSS concerns.

> Could you at least add a Javascript confirmation dialog please? :-)

That would be even more effort than looking into the existing issue,
unless code is provided.

Regards,
Martin
___
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] Catch SIGINT at Python startup

2010-03-11 Thread Brett Cannon
On Wed, Mar 10, 2010 at 17:21, Victor Stinner
wrote:

> Hi,
>
> Some news about my patch.
>
> Le lundi 08 mars 2010 19:21:20, Maciej Fijalkowski a écrit :
> > On Mon, Mar 8, 2010 at 10:47 AM, Guido van Rossum 
> wrote:
> > > Actually it sounds like there's some overly general except clause
> > > somewhere that should be adjusted to catch just "Exception" instead of
> > > "*".
> >
> > There is at least one that prints "import 'site' failed" and continues
> > to run your program.
>
> I commited to patch and broke all buildbots \o/ There were errors in
> test_sysconfig and test_subprocess related to issues #7774 and #7880
> (problems
> with sys.executable and modified sys.argv[0]).
>
> I consider that it's a good point to detect the errors earlier, but it
> breaks
> code based on the errors :-) I will no backport the fix to 2.6 (or at
> least,
> not the fix about importing the site module)
>
> Should I backport the fix to 3.1? (The backport to py3k is not done yet)
>
>
Once you are happy with the stability then please port it to 3.1.

-Brett




>  --
> Victor Stinner
> http://www.haypocalc.com/
> ___
> Python-Dev mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/brett%40python.org
>
___
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] Catch SIGINT at Python startup

2010-03-11 Thread Benjamin Peterson
2010/3/11 Brett Cannon :
>
>
> On Wed, Mar 10, 2010 at 17:21, Victor Stinner 
> wrote:
>>
>> Hi,
>>
>> Some news about my patch.
>>
>> Le lundi 08 mars 2010 19:21:20, Maciej Fijalkowski a écrit :
>> > On Mon, Mar 8, 2010 at 10:47 AM, Guido van Rossum 
>> > wrote:
>> > > Actually it sounds like there's some overly general except clause
>> > > somewhere that should be adjusted to catch just "Exception" instead of
>> > > "*".
>> >
>> > There is at least one that prints "import 'site' failed" and continues
>> > to run your program.
>>
>> I commited to patch and broke all buildbots \o/ There were errors in
>> test_sysconfig and test_subprocess related to issues #7774 and #7880
>> (problems
>> with sys.executable and modified sys.argv[0]).
>>
>> I consider that it's a good point to detect the errors earlier, but it
>> breaks
>> code based on the errors :-) I will no backport the fix to 2.6 (or at
>> least,
>> not the fix about importing the site module)
>>
>> Should I backport the fix to 3.1? (The backport to py3k is not done yet)
>>
>
> Once you are happy with the stability then please port it to 3.1.
> -Brett

But after 3.1.2 please!



-- 
Regards,
Benjamin
___
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] Catch SIGINT at Python startup

2010-03-11 Thread Brett Cannon
On Thu, Mar 11, 2010 at 13:33, Benjamin Peterson wrote:

> 2010/3/11 Brett Cannon :
> >
> >
> > On Wed, Mar 10, 2010 at 17:21, Victor Stinner <
> [email protected]>
> > wrote:
> >>
> >> Hi,
> >>
> >> Some news about my patch.
> >>
> >> Le lundi 08 mars 2010 19:21:20, Maciej Fijalkowski a écrit :
> >> > On Mon, Mar 8, 2010 at 10:47 AM, Guido van Rossum 
> >> > wrote:
> >> > > Actually it sounds like there's some overly general except clause
> >> > > somewhere that should be adjusted to catch just "Exception" instead
> of
> >> > > "*".
> >> >
> >> > There is at least one that prints "import 'site' failed" and continues
> >> > to run your program.
> >>
> >> I commited to patch and broke all buildbots \o/ There were errors in
> >> test_sysconfig and test_subprocess related to issues #7774 and #7880
> >> (problems
> >> with sys.executable and modified sys.argv[0]).
> >>
> >> I consider that it's a good point to detect the errors earlier, but it
> >> breaks
> >> code based on the errors :-) I will no backport the fix to 2.6 (or at
> >> least,
> >> not the fix about importing the site module)
> >>
> >> Should I backport the fix to 3.1? (The backport to py3k is not done yet)
> >>
> >
> > Once you are happy with the stability then please port it to 3.1.
> > -Brett
>
> But after 3.1.2 please!
>

Sorry, I meant py3k (aka 3.2) and not 3.1. Since this is a behavior change I
don't think it should be in 2.6/3.1.

-Brett



>
>
>
> --
> Regards,
> Benjamin
>
___
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] Catch SIGINT at Python startup

2010-03-11 Thread Victor Stinner
Le jeudi 11 mars 2010 21:58:11, Brett Cannon a écrit :
> > (...)
> > Should I backport the fix to 3.1? (The backport to py3k is not done yet)
> 
> Once you are happy with the stability then please port it to 3.1.

My commit broke test_sysconfig, test_platform and test_subprocess. Some 
commits later, #7880 is fixed and part of #7774 is also fixed. So yes, it will 
be possible to port the fix to py3k.

-- 
Victor Stinner
http://www.haypocalc.com/
___
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


[Python-Dev] interesting article on regex performance

2010-03-11 Thread Neal Becker
http://swtch.com/~rsc/regexp/regexp1.html

___
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] interesting article on regex performance

2010-03-11 Thread Peter Portante
http://code.google.com/p/re2/


On 3/11/10 8:52 PM, "Neal Becker"  wrote:

> http://swtch.com/~rsc/regexp/regexp1.html
> 
> ___
> Python-Dev mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/peter.a.portante%40gmail.com


___
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