bazelbuild / bazelbuild/bazel

In Starlark debugger, emit comprehension variables in new frames rather than in their enclosing function's frame

Open
#24,931 2 comments 0 reactions 0 assignees View on GitHub
P3 team-Starlark-Interpreter type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

Cloned from https://github.com/bazelbuild/bazel/issues/24919#issuecomment-2593098691:

From @fmeum:

> I checked what PyCharm's debugger is doing in this case. It emits additional `` frame that holds the value of `x` as passed into `g` through `j`. The frame below it has `x` at the value passed into `foo` (and later updated via the `+=`).

A new frame is probably the right way to present this. Unfortunately, while this is easy in cpython (where I believe the intepreter physically pushes new frames for comprehensions), it's not easy in starlark (to save memory, the starlark resolver puts comprehension's variables into the enclosing function's frame).

Contributor guide

Open the contributing guide

Research direction

Start by tracing the Starlark debugger's frame handling alongside the resolver behavior that places comprehension variables in the enclosing function's frame. Compare the result with the described PyCharm behavior; done means comprehension variables appear in their own debugger frames while the enclosing frame retains its original values.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.