fix(python): run the Python Console in a Docker or Compose interpreter's container (#6686)

With a Docker or Compose run target as the project interpreter, the Python Console reported "No Python interpreter" because it only asked for a local interpreter. When there is none but a run target interpreter is set, the console now starts its driver as a python run, which Run already routes into the target's container (project mounted, the target's interpreter, docker stop on Stop). The driver exits on SIGTERM itself, since as a container's PID 1 it would otherwise ignore Stop until docker's SIGKILL.

Closes #6685.

Co-authored-by: wildcatDownstairs <[email protected]>
Цей коміт міститься в:
LU XIANGRUIтаwildcatDownstairs authored and GitHub committed 2026-11-28 20:49:10 +08:00
1 джерело 482143769f
коміт 611440f77f
4 files changed
+43 -3

No files matched your search

+4
Переглянути файл
@@ -4,11 +4,15 @@
import json
import os
import reprlib
import signal
import sys
import textwrap
import types
RS = "\x1e"
# In a container (`docker compose run` has no `--init`) the driver is PID 1, which ignores
# SIGTERM without a handler: Stop would wait for docker's SIGKILL after 10 s.
signal.signal(signal.SIGTERM, lambda *_: os._exit(128 + signal.SIGTERM))
_out = sys.stdout
_repr = reprlib.Repr()
_repr.maxstring = _repr.maxother = 200