(self, *ex_info)
| 1524 | self._stack.append((old_device_name, old_device_spec, new_device_spec)) |
| 1525 | |
| 1526 | def __exit__(self, *ex_info): |
| 1527 | ctx = self._ctx |
| 1528 | old_device_name, old_device_spec, new_device_spec = self._stack[-1] |
| 1529 | if ctx.device_spec is not new_device_spec: |
| 1530 | raise RuntimeError( |
| 1531 | "Exiting device scope without proper scope nesting") |
| 1532 | del self._stack[-1] |
| 1533 | ctx._set_device(old_device_name, old_device_spec) # pylint: disable=protected-access |
| 1534 | |
| 1535 | |
| 1536 | # Do not set directly. Use _set_context. |
nothing calls this directly
no test coverage detected