Skip to content

Commit

Permalink
Use Interpreter for unmanaged interpreters.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsnowcurrently committed Apr 9, 2024
1 parent a58626f commit dcf6e8c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Lib/test/support/interpreters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,13 @@ def create():

def list_all():
"""Return all existing interpreters."""
mainid = _interpreters.get_main()
return [Interpreter(id, _owned=owned)
for id, owned in _interpreters.list_all()
if owned or id == mainid]
for id, owned in _interpreters.list_all()]


def get_current():
"""Return the currently running interpreter."""
id, owned = _interpreters.get_current()
if not owned and id != _interpreters.get_main():
# XXX Support this?
raise InterpreterError('current interpreter was created externally')
return Interpreter(id, _owned=owned)


Expand Down Expand Up @@ -168,6 +163,7 @@ def _decref(self):
def id(self):
return self._id

# XXX Is this the right name?
@property
def owned(self):
return self._owned
Expand Down

0 comments on commit dcf6e8c

Please sign in to comment.