Feature or enhancement
Proposal:
When using subinterpreters, it's common to write code like this:
interp = interpreters.create()
try:
... # Do super cool stuff with the interpreter
finally:
interp.close()
This pattern is particularly common in our test suite.
Lucky for us, Python has had a feature for ~20 years that simplifies this case (with!). Let's support that with subinterpreters by implementing the context manager protocol for Interpreter objects, like so:
with interpreters.create() as interp:
... # Do something with 'interp'
cc @ericsnowcurrently as the (concurrent.)interpreters mastermind
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
Feature or enhancement
Proposal:
When using subinterpreters, it's common to write code like this:
This pattern is particularly common in our test suite.
Lucky for us, Python has had a feature for ~20 years that simplifies this case (
with!). Let's support that with subinterpreters by implementing the context manager protocol forInterpreterobjects, like so:cc @ericsnowcurrently as the (
concurrent.)interpretersmastermindHas this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
Interpreterobjects #158372