MCPcopy Index your code
hub / github.com/python/cpython / _new_channel

Method _new_channel

Lib/test/test__interpchannels.py:1474–1488  ·  view source on GitHub ↗
(self, creator)

Source from the content-addressed store, hash-verified

1472 # internal methods
1473
1474 def _new_channel(self, creator):
1475 if creator.name == 'main':
1476 return _channels.create(REPLACE)
1477 else:
1478 ch = _channels.create(REPLACE)
1479 run_interp(creator.id, f"""
1480 import _interpreters
1481 cid = _xxsubchannels.create()
1482 # We purposefully send back an int to avoid tying the
1483 # channel to the other interpreter.
1484 _xxsubchannels.send({ch}, int(cid), blocking=False)
1485 del _interpreters
1486 """)
1487 self._cid = recv_nowait(ch)
1488 return self._cid
1489
1490 def _get_interpreter(self, interp):
1491 if interp in ('same', 'interp'):

Callers 1

cidMethod · 0.95

Calls 3

run_interpFunction · 0.85
recv_nowaitFunction · 0.85
createMethod · 0.45

Tested by

no test coverage detected