Skip to content

Commit 156c8f9

Browse files
committed
GR-20806: treat the lambda case
- still missing treating free vars
1 parent 19defce commit 156c8f9

File tree

2 files changed

+5
-2
lines changed
  • graalpython
    • com.oracle.graal.python.test/src/tests
    • com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/code

2 files changed

+5
-2
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_code.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,5 @@ def foo():
182182
pass
183183

184184
ct = type(foo.__code__)
185+
del foo
185186
ct(2, 0, 0, 128, 0, b"lambda a,b: a+b", tuple(), ("a", "b"), tuple(), "hello.py", "<lambda>", 0, b"", tuple(), tuple())

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/code/CodeNodes.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ private PCode createCode(LazyPythonClass cls, int argcount, int kwonlyargcount,
137137
Object[] args = PArguments.create();
138138
PDict globals = factory.createDict();
139139
PArguments.setGlobals(args, globals);
140-
InvokeNode.invokeUncached(Truffle.getRuntime().createCallTarget(rootNode), args);
141-
Object function = ensureGetItemNode().execute(null, globals.getDictStorage(), name);
140+
Object function = InvokeNode.invokeUncached(Truffle.getRuntime().createCallTarget(rootNode), args);
141+
if (function == PNone.NONE) {
142+
function = ensureGetItemNode().execute(null, globals.getDictStorage(), name);
143+
}
142144
if (function instanceof PFunction) {
143145
rootNode = ((PFunction) function).getFunctionRootNode();
144146
} else {

0 commit comments

Comments
 (0)