On Thu, 16 Dec 2021 11:38:28 -0700
Eric Snow <ericsnowcurren...@gmail.com> wrote:

> On Thu, Dec 16, 2021 at 4:34 AM Antoine Pitrou <anto...@python.org> wrote:
> > As a data point, in PyArrow, we have a bunch of C++ code that interacts
> > with Python but doesn't belong in a particular Python module.  That C++
> > code can of course have global state, including perhaps Python objects.  
> 
> Thanks for that example!
> 
> > What might be nice would be a C API to allow creating interpreter-local
> > opaque structs, for example:
> >
> > void* Py_GetInterpreterLocal(const char* unique_name);
> > void* Py_SetInterpreterLocal(const char* unique_name,
> >                              void* ptr, void(*)() destructor);  
> 
> That's interesting.  I can imagine that as just a step beyond the
> module state API, with the module being implicit.  Do you think this
> would be an improvement over using module state?  (I'm genuinely
> curious.)

It would certainly be much easier to use (you just have to choose a
unique name, like e.g. for capsules).

Regards

Antoine.


_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/4DIIJJKJBPGWL3UX5WNU35QRJX7U3BBA/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to