Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue15751] Add PyGILState_SwitchInterpreter

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Aug 20, 2012, 10:18 PM

Post #1 of 23 (366 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter

New submission from Nick Coghlan:

Currently, modules that use the PyGILState* APIs cannot be used with mod_wsgi, as mod_wsgi uses the subinterpreter support.

Graham Dumpleton and I spent some time discussing this at PyCon AU 2012, and we believe that the incompatibility can be resolved with a single API in the core: a function that mod_wsgi can call to set the interpreter used by the GIL state APIs to implicitly create new thread states.

This is still only a seed of an idea (and it's entirely possible we've missed something), but it's a place to start in resolving this longstanding incompatibility.

----------
messages: 168742
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Add PyGILState_SwitchInterpreter
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 4:56 AM

Post #2 of 23 (363 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Graham Dumpleton added the comment:

Just to clarify. One can still tell WSGI applications under mod_wsgi to run in the main interpreter and in that case modules using PyGILState* do work. By default though, sub interpreters are used as noted.

The mechanism for forcing use of main interpreter is the directive:

WSGIApplicationGroup %{GLOBAL}

Some details about this issue can be found in:

http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Python_Simplified_GIL_State_API

----------
nosy: +grahamd

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 5:56 AM

Post #3 of 23 (364 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Antoine Pitrou added the comment:

> a function that mod_wsgi can call to set the interpreter used by the
> GIL state APIs to implicitly create new thread states.

How would it work?

----------
nosy: +pitrou

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 6:21 AM

Post #4 of 23 (362 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Nick Coghlan added the comment:

It would twiddle the autoInterpreterState and autoTLSkey entries in the pystate.c global variables to point to a different subinterpreter.

As I understand the situation, mod_wsgi doesn't need arbitrary externally created threads to be able to call back into arbitrary subinterpreters, it just needs to be able to direct externally created threads in a process to a subinterpreter other than the main one.

Graham, looking at the current impl - have you experimented with just calling _PyGILState_Init() with the interpreter state and current thread state for the desired subinterpreter to see what happens?

I think the new method could just be a cleaner combination of _PyGILState_ReInit and _PyGILState_Init. If I'm right, then calling _PyGILState_Init should convert the current crashes and deadlocks into a relatively less harmful memory leak (since the old entry in the TLS won't get deleted properly).

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 6:25 AM

Post #5 of 23 (367 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Nick Coghlan added the comment:

Graham, even better would be if you could try the following combination:

_PyGILState_Fini();
_PyGILState_Init(si, st);

(where si and st are the interpreter state and thread state for the target subinterpreter)

If a new PyGILState_SwitchInterpreter API is going to be able to solve this in 3.4, then I believe those private APIs should be enough to make it possible in *current* versions.

If those private APIs *aren't* enough, then I'm missing something and this isn't going to be as easy as I thought.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 6:28 AM

Post #6 of 23 (363 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Antoine Pitrou added the comment:

> As I understand the situation, mod_wsgi doesn't need arbitrary
> externally created threads to be able to call back into arbitrary
> subinterpreters, it just needs to be able to direct externally created
> threads in a process to a subinterpreter other than the main one.

But how does it know that the right externally created thread will point
to the right subinterpreter? The OS is free to schedule threads as it
desires.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 7:06 AM

Post #7 of 23 (364 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Nick Coghlan added the comment:

Just as they do today, all externally created threads will still go to *one* interpreter when they hit PyGILState_Ensure(). It's just that interpreter won't be the main one.

Since the whole point of the PyGILState API is to support threads that don't have a previously created thread state, there's no getting around the requirement to have a single blessed interpreter that handles all externally created threads in a given process.

It will be up to mod_wsgi (and any other embedding application that uses the new function) to make sure it calls this at a time when there aren't any existing calls to PyGILState that would be disrupted. (Assuming we can't figure out a locking scheme that *ensures* no such threads are running when the switch occurs)

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 7:10 AM

Post #8 of 23 (360 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Antoine Pitrou added the comment:

> Just as they do today, all externally created threads will still go to
> *one* interpreter when they hit PyGILState_Ensure(). It's just that
> interpreter won't be the main one.

Uh but how does it solve the issue? (unless you create a mod_wsgi app
with only a single worker thread)

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 7:33 AM

Post #9 of 23 (361 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Nick Coghlan added the comment:

My understanding of the mod_wsgi architecture is that it uses subinterpreters to maintain a persistent process, while still providing a relatively pristine interpreter state to handle each new request. This means even when you're using multiple processes with a single request handling thread per process, you're running a subinterpreter unless you explicitly configure mod_wsgi to always run in the main interpreter (which, I believe, will result in additional state persistence across requests).

The proposed API change can only fix scenarios where *at a given point in time*, *all* PyGILState_Ensure calls should be directed to a particular subinterpreter. The target subinterpreter may change *later*, but there still cannot be two desired targets within the same process at the same time.

However, at the moment, PyGILState doesn't even allow that - all externally created threads are handled in the *main* interpreter even if that isn't what the embedding application wants.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 7:44 AM

Post #10 of 23 (367 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Nick Coghlan added the comment:

Sorry, I mischaracterised the way mod_wsgi works slightly. However, my understanding is still that the scope of this particular fix is merely to allow all external threads to be redirected to a different subinterpreter at various times over the life of a process. It does not need to allow different external threads to be redirected to different subinterpreters.

(Note: I am assuming that any hooks Apache/mod_wsgi has into external thread creation could already just create an appropriate thread state if that was the desired behaviour. It may be I'm incorrect on this, and what Graham really wants is the ability to change the target interpreter state just for the current thread. However, if that's what he wants, then there's additional background info I need on mod_wsgi and its ability to influence thread creation within a process, because I didn't get the impression on the weekend that that is what he was after)

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 7:47 AM

Post #11 of 23 (364 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Antoine Pitrou added the comment:

> My understanding of the mod_wsgi architecture is that it uses
> subinterpreters to maintain a persistent process, while still
> providing a relatively pristine interpreter state to handle each new
> request.

I don't think that's true. On hg.python.org, the hglookup application
keeps a cached mapping of changeset ids to repo URLs, which wouldn't be
possible if its interpreter was re-bootstrapped for each new request.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 8:23 AM

Post #12 of 23 (364 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Nick Coghlan added the comment:

s/slightly/completely/ (I believe my description of the core problem was right, but my description of why that problem exists was wrong - it actually has to do with the way mod_wsgi handles virtual hosts and endpoints)

If we expose an official way to switch the destination of the PyGILState APIs, then what it means is that mod_wsgi can, over the lifecycle of a single process in the pool, *switch* the virtual host and WSGI endpoint that process is handling by changing the active interpreter. There are still some extension modules where that won't work (because they create persistent threads that periodically call back into Python, so they may still end up calling back in to the wrong interpreter), but it will allow those that just do callbacks from external worker threads (or other operations that are similarly bound by the lifecycle of a request) to start working properly.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 8:51 AM

Post #13 of 23 (364 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Antoine Pitrou added the comment:

> If we expose an official way to switch the destination of the
> PyGILState APIs, then what it means is that mod_wsgi can, over the
> lifecycle of a single process in the pool, *switch* the virtual host
> and WSGI endpoint that process is handling by changing the active
> interpreter.

I don't understand what that means. It's the OS which switches threads,
including interpreter threads.

(by the way, the real fix to the GILState vs. subinterpreters issue
would be to create new API functions which take an interpreter as
argument, so that you have a distinct TLS key per interpreter)

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 9:08 AM

Post #14 of 23 (362 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Nick Coghlan added the comment:

Umm, no. The whole point of the GILState API is that you can call it from a thread which knows *nothing* about Python.

It will then use the *process global* state in the pystate.c statics to initialise that thread with a Python thread state. Currently, that thread state will always be for the main Python interpreter for the process.

All Graham wants is an officially supported way to change which interpreter the pystate.c globals reference *without* shutting down and reinitialising Python completely.

There are going to be limitations on how effective this will be - it still won't support *all* extension modules that use the PyGILState APIs. It will, however, support many more of them than the status quo (which is zero, unless you force your WSGI app to use the main interpreter, which has its own problems).

And you absolutely can control when the OS switches threads - controlling that is what synchronisation primitives are *for*.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 9:27 AM

Post #15 of 23 (362 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Antoine Pitrou added the comment:

> Umm, no. The whole point of the GILState API is that you can call it
> from a thread which knows *nothing* about Python.

No to what? Any sane callback API allows to pass it some user data, that
user data can just as well include the pointer to the desired
interpreter. Really, that's the right way to do it. Since a new API is
required, we can indeed add tweaks to the current API until the
migration is done, but I'm quite sure any proper solution to the problem
requires explicitly passing the interpreter.

> There are going to be limitations on how effective this will be - it
> still won't support *all* extension modules that use the PyGILState
> APIs. It will, however, support many more of them than the status quo

I still don't understand how that allows to "support some extension
modules" (which ones?).
A typical mod_wsgi setup uses several threads per daemon process, and
each thread (AFAIU) uses a separate subinterpreter for its WSGI
application instance (Graham, is that false?). Therefore, an
externally-launched thread can relate to *any* of these subintepreters,
which are themselves scheduled by the OS.

> And you absolutely can control when the OS switches threads -
> controlling that is what synchronisation primitives are *for*.

I don't think mod_wsgi has access to enough hooks or information to do
that satisfyingly (like the OS would do). Besides, I don't understand
how mod_wsgi could have control over the scheduling of
externally-launched threads. Therefore, an externally-launched thread
could be scheduled at any time, and not only after the "right"
interpreter thread was interrupted.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 3:14 PM

Post #16 of 23 (367 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Graham Dumpleton added the comment:

In both embedded mode and daemon mode of mod_wsgi, albeit how thread pool is managed is different, there is a fixed number of threads with those being dedicated to handling web requests.

On a request arriving next available thread from the thread pool handles accepting of request at C code level, that thread may then map to any WSGI application and so any sub interpreter, or even the main interpreter.

Thus there is no one to one mapping between thread and (sub)interpreter.

The way the mod_wsgi code works now is that when it knows it will be calling into the main interpreter, it uses PyGILState_Ensure(). If not, it will use a thread state for that thread specific to the sub interpreter it is calling in to. At the end of the request, the thread state is remembered and not thrown away so that thread locals still work for that thread across requests for that sub interpreter.

Thus, there can be more than one thread state per thread, but this is fine so long as it is only used against the sub interpreter it was created for.

This is actually an enforced requirement of Python, because if you create more than one thread state for a thread for the same sub interpreter, or even an additional one for the main interpreter when there is also the auto TLS, then Python will die if you compile and run it is in debug mode.

Now, since mod_wsgi always knows which interpreter it is calling into, the intent was that there was this single API call so that mod_wsgi could say that at this time, this thread is going to be calling into that interpreter. It could then just call PyGILState_Ensure().

Any third party module then which uses the simplistic calling sequence of calling PyGILState_Release() on exiting Python code and thence within the same thread calling PyGILState_Ensure() when coming back into Python with a callback will work, as mod_wsgi has specified the interpreter context for that thread at that time.

As pointed out, if a third party module was creating its own background threads at C level and calling PyGILState_Ensure() when calling back into Python code, this could pose a problem. This could also be an issue for Python created background threads.

In the case of the latter, if a Python thread is created in a specific sub interpreter, it should automatically designate for that thread that that is its interpreter context, so if it calls out and does the Release/Ensure dance, that it goes back into the same sub interpreter.

The C initiated thread is a bit more complicated though and may not be solvable, but a lot of the main third party modules which don't work in sub interpreters, such as lxml, don't use background threads, so the simplistic approach means that will work at least.

So, in summary, saw a single API call which allowed designation of which interpreter a thread is operating against, overriding the implicit default of the main interpreter. PyGILState API will need to manage a set of interpreter states for each interpreter, with potential for more than one thread state for a thread due to a thread being able to call into multiple interpreters at different times.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 3:31 PM

Post #17 of 23 (364 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Antoine Pitrou added the comment:

Le mardi 21 août 2012 à 22:14 +0000, Graham Dumpleton a écrit :
> Any third party module then which uses the simplistic calling sequence
> of calling PyGILState_Release() on exiting Python code and thence
> within the same thread calling PyGILState_Ensure() when coming back
> into Python with a callback will work, as mod_wsgi has specified the
> interpreter context for that thread at that time.

Why would a module do that, instead of using
Py_{BEGIN,END}_ALLOW_THREADS?

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 3:36 PM

Post #18 of 23 (360 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Graham Dumpleton added the comment:

Those macros only work for general GIL releasing and pop straight away, not for the case where released, calls into some non Python C library, which then calls back into Python.

My recollection is, and so unless they have changed it, SWIG generated calls use the GILState calls. See:

https://issues.apache.org/jira/browse/MODPYTHON-217

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 3:56 PM

Post #19 of 23 (362 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Antoine Pitrou added the comment:

> Those macros only work for general GIL releasing and pop straight
> away, not for the case where released, calls into some non Python C
> library, which then calls back into Python.

I see, so you are right that this new API could be useful. However, we
should also add a new GIL state API that fixes the issue for good (by
passing an interpreter), otherwise we will still have such discussions
in five years and it will be very silly.

> My recollection is, and so unless they have changed it, SWIG generated
> calls use the GILState calls. See:

Well, if SWIG isn't fixed, people should stop using an unmaintained and
buggy tool.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 5:46 PM

Post #20 of 23 (362 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Graham Dumpleton added the comment:

If you have a Ex version of Ensure, then if the interpreter argument is NULL, then it should assume main interpreter. That way the normal version of Ensure can just call PyGILState_EnsureEx(NULL).

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 24, 2012, 5:06 AM

Post #21 of 23 (342 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Changes by Andrew Svetlov <andrew.svetlov [at] gmail>:


----------
nosy: +asvetlov

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 24, 2012, 5:35 AM

Post #22 of 23 (343 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Nick Coghlan added the comment:

I'm not sure it makes sense to call this new API "PyGILState_EnsureEx". My concern is that the behaviour is quite different in the presence of an existing thread state:

Ensure:
- if a thread state exists, use that interpreter
- otherwise, use the default interpreter configured in the pystate.c globals

New API:
- if a thread state exists, and the interpreter doesn't match the requested one, fail with an error
- otherwise, use the requested interpreter

I guess it makes sense if we treat the NULL pointer as the degenerate case meaning "use the interpreter of this thread, or the default interpreter if no interpreter has been declared for this thread". PyGILState_Ensure would then simply call PyGILState_EnsureEx(NULL) internally.

So, my question for Graham would be, given this ability, would mod_wsgi still need the ability to change the default interpreter? Or would it be enough for you to be able to register the threads *you* create with a specific interpreter?

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 24, 2012, 5:45 AM

Post #23 of 23 (341 views)
Permalink
[issue15751] Add PyGILState_SwitchInterpreter [In reply to]

Antoine Pitrou added the comment:

> New API:
> - if a thread state exists, and the interpreter doesn't match the
> requested one, fail with an error
> - otherwise, use the requested interpreter

That's not what I'm proposing. What I'm proposing is that the new API
uses a per-interpreter TLS key (so you can have several thread states
per OS thread).

So basically:

Ensure:
- look up global TLS key, which returns the thread state
- if no thread state (TLS lookup failed), create a new one for the main
interpreter and register it on the global TLS key

New API:
- look up the interpreter's TLS key, which returns the thread state
- if no thread state (TLS lookup failed), create a new one for the
interpreter and register it on the interpreter's TLS key

Graham is merely suggesting for simplification that "global TLS key" ==
"main interpreter's TLS key", so Ensure(...) ==
EnsureEx(main_interpreter, ...).

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.