(original) (raw)

I don't want to expose a SetContext operation because of, again, potential incompatibility with PEP 550, where generators expect to fully control push/pop context operation.

Second, Context.run is 100% enough for \*any\* async framework to add support for PEP 567\. And because the PEP is focused just on async, I think that we don't need anything more than 'run'.

Third, I have a suspicion that we focus too much on actual Context and Context.run. These APIs are meant for asyncio/twisted/trio/etc maintainers, not for an average Python user. An average person will likely not interact with any of the PEP 567 machinery directly, wven when using PEP 567-enabled libraries like numpy/decimal.

Yury

On Wed, Jan 3, 2018 at 2:56 AM Victor Stinner <victor.stinner@gmail.com> wrote:
PEP:
"int PyContext\_Enter(PyContext \*) and int PyContext\_Exit(PyContext \*) allow to set and restore the context for the current OS thread."

What is the difference between Enter and Exit? Why not having a single Py\_SetContext() function?

Victor
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/yselivanov.ml%40gmail.com