[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Objects object.c,2.106,2.107
Guido van Rossum
guido@python.org
Wed, 17 Jan 2001 22:40:31 -0500
> > - Change the in-progress code to use static variables instead of
> > globals (both the nesting level and the key for the thread dict were
> > globals but have no reason to be globals; the key can even be a
> > function-static variable in get_inprogress_dict()).
>
> The "compare_nesting" variable is a bit troublesome long-term -- it will
> cause threading issues in a free-threaded implementation. The solution is to
> put the value into the thread-state.
>
> [ not sure if it matters right now, but just bringing it up ]
Good point -- especially since the in-progress-dict is already part of
the thread state. Jeremy explained to me that the compare_nesting
variable is mostly an optimization (avoiding the work with the
in-progress-dict when we don't know for sure that it's worth it) but
yes, mixing nesting levels (even if the dicts are separate) could
cause coupling or interference between threads...
--Guido van Rossum (home page: http://www.python.org/~guido/)