PY-57217 Breakpoints are ignored with Python 3.11

IJ-CR-103963

GitOrigin-RevId: 18faf5bc5c995decc948cbe1314773b0776ffc63
This commit is contained in:
Egor Eliseev
2023-03-02 12:20:10 +02:00
committed by intellij-monorepo-bot
parent 83e4863ca1
commit 68947cc4dc
2 changed files with 13 additions and 1 deletions

View File

@@ -5,7 +5,7 @@ import traceback
from _pydev_imps._pydev_saved_modules import threading
from _pydevd_bundle.pydevd_constants import get_global_debugger, IS_WINDOWS, IS_MACOS, \
IS_JYTHON, IS_PY36_OR_LESSER, IS_PY36_OR_GREATER, IS_PY38_OR_GREATER, \
get_current_thread_id
get_current_thread_id, IS_PY311_OR_GREATER
from _pydev_bundle import pydev_log
try:
@@ -63,6 +63,16 @@ def _is_already_patched(args):
def _is_py3_and_has_bytes_args(args):
if not isinstance('', type(u'')):
return False
if len(args) == 0:
return False
# PY-57217 Uvicorn with '-reload' flag when starting a new process in Python3.11 passes the path to the interpreter as bytes
if IS_PY311_OR_GREATER and isinstance(args[0], bytes):
interpreter = args[0].decode('utf-8')
if is_python(interpreter):
args[0] = interpreter
for arg in args:
if isinstance(arg, bytes):
return True