[Python-Dev] PEP 567 v2 (original) (raw)
Victor Stinner victor.stinner at gmail.com
Wed Jan 3 19:09:42 EST 2018
- Previous message (by thread): [Python-Dev] PEP 567 v2
- Next message (by thread): [Python-Dev] PEP 567 v2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
2018-01-04 0:44 GMT+01:00 Victor Stinner <victor.stinner at gmail.com>:
The behaviour is more tricky than what I expected. While running context.run(), the context object is out of sync of the "current context". It's only synchronized again at run() exit. So ContextVar.set() doesn't immediately modifies the "current context" object (set by Context.run()).
A better description of Context.run() behaviour would be:
"Create a copy of the context and sets it as the current context. Once the function completes, updates the context from the copy."
This description explains why run() doesn't immediately updates the context object.
Victor
- Previous message (by thread): [Python-Dev] PEP 567 v2
- Next message (by thread): [Python-Dev] PEP 567 v2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]