[Python-Dev] pthread sem PyThread_acquire_lock

2009-06-27 Thread Florian Mayer

Hello.
As this is my first post I will try to introduce myself as requested in 
the welcome email. If you aren't interested in my person, just continue 
reading at the next paragraph. I'm a student from Vienna/Austria. I 
attend what would match high school in the United States. I have been 
writing Python for about 3 years now and have just began to dig into the 
implementation of CPython.


Now to my real question. I have noticed that PyThread_acquire_lock 
swallows all signals with pthread using sems. Looking at the source code 
it appears that this is intended, but I cannot see the reason for that. 
It seems the pthread sem implementation is the only one doing so. Can 
any of you tell me the reason why it swallows signals?


I have already prepared a patch that introduces a new _noswallow 
function if sem are used and uses this in threadmodule.c. But if there 
isn't any real reason for it to swallow exceptions, I think it would be 
wisest to change that.


Best regards,
Florian Mayer
___
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] pthread sem PyThread_acquire_lock

2009-06-27 Thread Florian Mayer

Martin v. Löwis wrote:
> Can you please explain what you mean by "swallowing"?
The signals don't get through when acquiring the lock.
> What is the sequence of actions triggering the case you are talking
> about, what happens, and what do you expect to happen instead?
Create a Lock object, call .acquire and try to press Ctrl-C, the 
keyboardinterrupt is swallowed

> Also, how would you fix this (in principle, not what the specific
> patch would look like)?
Remove the loop that explicitly does this in a new function and use that 
one in threadmodule.c for lock.acquire.

>
> Regards,
> Martin
Best regards,
Florian

PS: Sorry for sending this message twice.
___
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] pthread sem PyThread_acquire_lock

2009-06-27 Thread Florian Mayer

Martin v. Löwis wrote:

Can you please explain what you mean by "swallowing"?

The signals don't get through when acquiring the lock.

What is the sequence of actions triggering the case you are talking
about, what happens, and what do you expect to happen instead?
Easiest way is to create a Queue.Queue and call .get() on it and try to 
Ctrl-C it.

Also, how would you fix this (in principle, not what the specific
patch would look like)?

Remove the loop that explicitly does this in a new function and use that
one in threadmodule.c for lock.acquire.


Regards,
Martin

Best regards,
Florian

PS: Excuse me, I messed up things once again.

___
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