diff --git a/src/debugpy/_vendored/force_pydevd.py b/src/debugpy/_vendored/force_pydevd.py index b4b2f904f..980948fda 100644 --- a/src/debugpy/_vendored/force_pydevd.py +++ b/src/debugpy/_vendored/force_pydevd.py @@ -22,6 +22,10 @@ os.environ[str("PYDEVD_DEBUG")] = str("True") os.environ[str("PYDEVD_DEBUG_FILE")] = os.environ["DEBUGPY_LOG_DIR"] + str("/debugpy.pydevd.log") +# Disable pydevd frame-eval optimizations only if unset, to allow opt-in. +if "PYDEVD_USE_FRAME_EVAL" not in os.environ: + os.environ[str("PYDEVD_USE_FRAME_EVAL")] = str("NO") + # Constants must be set before importing any other pydevd module # # due to heavy use of "from" in them. with vendored('pydevd'): diff --git a/tests/debugpy/test_run.py b/tests/debugpy/test_run.py index 280bb5cee..3502ab8da 100644 --- a/tests/debugpy/test_run.py +++ b/tests/debugpy/test_run.py @@ -325,7 +325,7 @@ def code_to_debug(): pass using_frame_eval = backchannel.receive() - assert using_frame_eval == (frame_eval in ("yes", "")) + assert using_frame_eval == (frame_eval == "yes") @pytest.mark.parametrize("run", [runners.all_launch[0]])