Re: [Python-Dev] What is the purpose of the _PyThreadState_Current symbol in Python 3?

2018年9月29日 03:03:41 -0700

On Fri, Sep 28, 2018 at 3:29 PM, Gabriele <[email protected]> wrote:
> On 2018年9月28日 at 23:12, Nathaniel Smith <[email protected]> wrote:
>> What information do you wish the interpreter provided, that would make your 
>> program simpler and more reliable?
>
> An exported global variable that points to the head of the
> PyInterpreterState linked list (i.e. the return value of
> PyInterpreterState_Head). This way my program could just look this up
> from the dynsym section instead of scanning a dump of the bss section
> in memory to find a possible candidate.
Hmm, it looks like in 3.7+, _PyRuntime is marked PyAPI_DATA, which I
think should make it exported from dynsym?
https://github.com/python/cpython/blob/4b430e5f6954ef4b248e95bfb4087635dcdefc6d/Include/internal/pystate.h#L206
And PyInterpreterState_Head is just _PyRuntime.interpreters.head. So
maybe this is already done...
-n
-- 
Nathaniel J. Smith -- https://vorpus.org
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to