9 Jan
2003
9 Jan
'03
6:07 a.m.
[Martin]
Tim Peters <tim.one@comcast.net> writes:
I'd like to intensify the problem, though: you're in a thread and you want to call a Python API function safely. Period.
Are there semantic requirements to the Python API in this context, with respect to the state of global things? E.g. when I run the simple string "import sys;print sys.modules", would I need to get the same output that I get elsewhere? If yes, is it possible to characterize "elsewhere" any better?
Yes, good catch. A PyInterpreterState must be known, and as you stated previously, it is trivial to get one of these and stash it away globally. The PyThreadState is the problem child. Mark.