Yury Selivanov <yseliva...@gmail.com> added the comment:

> Is there any existing API that can be used to call `lib.set_state` on context 
> changes?

No, but there's C API that you can use to get/set contextvars. If a C library 
is hard coded to use threadlocals I'm afraid there's nothing we can do about it 
except fixing their C code to make state storage pluggable.

What library do you have in mind?

> If not, would it make sense to extend `contexvars` to allow users to 
> configure that `lib.set_state` is called on context change?

Theoretically yes, for debug purposes at least.  But I still fail to see how 
you could use that API even if it existed.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39660>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to