This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yselivanov
Recipients leezu, rhettinger, yselivanov
Date 2020-02-20.22:44:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582238694.14.0.30732630205.issue39660@roundup.psfhosted.org>
In-reply-to
Content
> 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.
History
Date User Action Args
2020-02-20 22:44:54yselivanovsetrecipients: + yselivanov, rhettinger, leezu
2020-02-20 22:44:54yselivanovsetmessageid: <1582238694.14.0.30732630205.issue39660@roundup.psfhosted.org>
2020-02-20 22:44:54yselivanovlinkissue39660 messages
2020-02-20 22:44:54yselivanovcreate