Skip to content

Commit 4deb7a6

Browse files
committed
respect PCell when getting value from frame
1 parent 41266ee commit 4deb7a6

File tree

1 file changed

+8
-4
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/common

1 file changed

+8
-4
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/common/LocalsStorage.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,12 @@ public MaterializedFrame getFrame() {
8888
}
8989

9090
private Object getValue(FrameSlot slot) {
91+
return getValue(this.frame, slot);
92+
}
93+
94+
private static Object getValue(MaterializedFrame frame, FrameSlot slot) {
9195
if (slot != null) {
92-
Object value = this.frame.getValue(slot);
96+
Object value = frame.getValue(slot);
9397
if (value instanceof PCell) {
9498
return ((PCell) value).getRef();
9599
}
@@ -113,7 +117,7 @@ private void calculateLength() {
113117
this.len = this.frame.getFrameDescriptor().getSize();
114118
for (FrameSlot slot : this.frame.getFrameDescriptor().getSlots()) {
115119
Object identifier = slot.getIdentifier();
116-
if (!FrameSlotIDs.isUserFrameSlot(identifier) || this.frame.getValue(slot) == null) {
120+
if (!FrameSlotIDs.isUserFrameSlot(identifier) || getValue(frame, slot) == null) {
117121
this.len--;
118122
}
119123
}
@@ -369,7 +373,7 @@ protected boolean loadNext() {
369373
Object identifier = nextCandidate.getIdentifier();
370374
if (identifier instanceof String) {
371375
if (FrameSlotIDs.isUserFrameSlot(identifier)) {
372-
Object nextValue = this.frame.getValue(nextCandidate);
376+
Object nextValue = getValue(this.frame, nextCandidate);
373377
if (nextValue != null) {
374378
this.nextFrameSlot = nextCandidate;
375379
return true;
@@ -396,7 +400,7 @@ protected boolean loadNext() {
396400
Object identifier = nextCandidate.getIdentifier();
397401
if (identifier instanceof String) {
398402
if (FrameSlotIDs.isUserFrameSlot(identifier)) {
399-
Object nextValue = this.frame.getValue(nextCandidate);
403+
Object nextValue = getValue(this.frame, nextCandidate);
400404
if (nextValue != null) {
401405
this.nextFrameSlot = nextCandidate;
402406
return true;

0 commit comments

Comments
 (0)