[Python-Dev] pthread sem PyThread_acquire_lock

Florian Mayer flormayer at aim.com
Sat Jun 27 20:43:18 CEST 2009

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

More information about the Python-Dev mailing list