Skip to content

Commit b4170b6

Browse files
committed
Implement PyEval_GetGlobals
1 parent 2c527a0 commit b4170b6

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextCEvalBuiltins.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,17 @@ static Object doGeneric(PCode code, Object globals, Object locals,
196196
return invokeNode.execute(rootCallTarget, pArguments);
197197
}
198198
}
199+
200+
@CApiBuiltin(ret = PyObjectBorrowed, args = {}, call = Direct)
201+
abstract static class PyEval_GetGlobals extends CApiNullaryBuiltinNode {
202+
@Specialization
203+
Object get(
204+
@Bind("this") Node inliningTarget,
205+
@Cached GetCurrentFrameRef getCurrentFrameRef,
206+
@Cached ReadCallerFrameNode readCallerFrameNode) {
207+
PFrame.Reference frameRef = getCurrentFrameRef.execute(null, inliningTarget);
208+
PFrame pFrame = readCallerFrameNode.executeWith(frameRef, 0);
209+
return pFrame.getGlobals();
210+
}
211+
}
199212
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/CApiFunction.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,6 @@ public final class CApiFunction {
715715
@CApiBuiltin(name = "PyEval_EvalFrameEx", ret = PyObject, args = {PyFrameObject, Int}, call = NotImplemented)
716716
@CApiBuiltin(name = "PyEval_GetFuncDesc", ret = ConstCharPtrAsTruffleString, args = {PyObject}, call = NotImplemented)
717717
@CApiBuiltin(name = "PyEval_GetFuncName", ret = ConstCharPtrAsTruffleString, args = {PyObject}, call = NotImplemented)
718-
@CApiBuiltin(name = "PyEval_GetGlobals", ret = PyObject, args = {}, call = NotImplemented)
719718
@CApiBuiltin(name = "PyEval_GetLocals", ret = PyObject, args = {}, call = NotImplemented)
720719
@CApiBuiltin(name = "PyEval_ReleaseLock", ret = Void, args = {}, call = NotImplemented)
721720
@CApiBuiltin(name = "PyEval_ReleaseThread", ret = Void, args = {PyThreadState}, call = NotImplemented)

0 commit comments

Comments
 (0)