[Python-Dev] PEP 567 v2 (original) (raw)

Nathaniel Smith njs at pobox.com
Wed Jan 3 20:35:56 EST 2018


On Wed, Jan 3, 2018 at 3:44 PM, Victor Stinner <victor.stinner at gmail.com> wrote:

Ok, I finally got access to a computer and I was able to test the PEP 567 implementation: see my code snippet below.

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()).

To me this sounds like a oversight (= bug), not intended behavior. At the conceptual level, I think what we want is:

(Note that I didn't say anything about HAMTs here, because that's orthogonal implementation detail. It would make perfect sense to have Context be an opaque wrapper around a regular dict; it would just give different performance trade-offs.)

-n

-- Nathaniel J. Smith -- https://vorpus.org



More information about the Python-Dev mailing list