[New-bugs-announce] [issue36124] Provide convenient C API for storing per-interpreter state
Nick Coghlan
report at bugs.python.org
Tue Feb 26 08:46:42 EST 2019
New submission from Nick Coghlan <ncoghlan at gmail.com>:
(New issue derived from https://bugs.python.org/issue35886#msg336501 )
cffi needs a generally available way to get access to a caching dict for the currently active subinterpreter. Currently, they do that by storing it as an attribute in the builtins namespace: https://bitbucket.org/cffi/cffi/src/07d1803cb17b230571e3155e52082a356b31d44c/c/call_python.c?fileviewer=file-view-default
As a result, they had to amend their code to include the CPython internal headers in 3.8.x, in order to regain access to the "builtins" reference.
Armin suggested that a nicer way for them to achieve the same end result is if there was a PyInterpreter_GetDict() API, akin to https://docs.python.org/3/c-api/init.html#c.PyThreadState_GetDict
That way they could store their cache dict in there in 3.8+, and only use the builtin dict on older Python versions.
----------
messages: 336670
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Provide convenient C API for storing per-interpreter state
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36124>
_______________________________________
More information about the New-bugs-announce
mailing list