[Python-Dev] GIL vs thread state

Thomas Heller theller@python.net
14 Apr 2003 17:35:34 +0200

Guido van Rossum <guido@python.org> writes:

> Maybe you should have a look at Mark Hammond's PEP 311.  It describes
> the problem and proposes a better solution.  (I think it requires you
> to always use the existing thread state for the thread, rather than
> making up a temporary thread state as is currently the idiom.)

I have only briefly skimmed the PEP, but I have the impression that it
proposes an new API, which may appear in 2.3 or 2.4.

> Ouch!  I don't know what structured exception handling is, but this
> looks like it would be as bad as using setjmp/longjmp to get back to
> right after execute_some_python_code().

Exactly. It basically does a longjmp() instead of crashing the process
with an access violation, for example.

>   That code could leak
> arbitrary Python references!!!

I consider access violations programming errors, so leaking references
would be ok. But I want to print a traceback instead of crashing (or at
least before crashing)

> If the docs are lying, they have to be fixed.  This is no longer my
> prime area of expertise... :-(

That's why I have been asking. I can submit a bug pointing to this