|
50 | 50 | import static com.oracle.graal.python.nodes.SpecialAttributeNames.__NAME__;
|
51 | 51 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__NEW__;
|
52 | 52 | import static com.oracle.graal.python.runtime.exception.PythonErrorType.OverflowError;
|
| 53 | +import static com.oracle.graal.python.util.PythonUtils.EMPTY_BYTE_ARRAY; |
| 54 | +import static com.oracle.graal.python.util.PythonUtils.EMPTY_OBJECT_ARRAY; |
53 | 55 |
|
54 | 56 | import java.io.PrintWriter;
|
55 | 57 | import java.math.BigInteger;
|
|
165 | 167 | import com.oracle.graal.python.builtins.objects.cext.common.CExtContext.Store;
|
166 | 168 | import com.oracle.graal.python.builtins.objects.cext.common.CExtParseArgumentsNode;
|
167 | 169 | import com.oracle.graal.python.builtins.objects.cext.common.CExtParseArgumentsNode.SplitFormatStringNode;
|
| 170 | +import com.oracle.graal.python.builtins.objects.code.CodeNodes; |
168 | 171 | import com.oracle.graal.python.builtins.objects.code.CodeNodes.GetCodeCallTargetNode;
|
169 | 172 | import com.oracle.graal.python.builtins.objects.code.CodeNodes.GetCodeSignatureNode;
|
170 | 173 | import com.oracle.graal.python.builtins.objects.code.PCode;
|
@@ -1488,6 +1491,22 @@ int tbHere(PFrame frame,
|
1488 | 1491 | }
|
1489 | 1492 | }
|
1490 | 1493 |
|
| 1494 | + @Builtin(name = "_PyTraceback_Add", minNumOfPositionalArgs = 1) |
| 1495 | + @GenerateNodeFactory |
| 1496 | + abstract static class PyTracebackAdd extends PythonTernaryBuiltinNode { |
| 1497 | + @Specialization |
| 1498 | + Object tbHere(String funcname, String filename, int lineno, |
| 1499 | + @Cached CodeNodes.CreateCodeNode createCodeNode, |
| 1500 | + @Cached PyTraceBackHereNode pyTraceBackHereNode) { |
| 1501 | + PCode code = createCodeNode.execute(null, 0, 0, 0, 0, 0, 0, |
| 1502 | + EMPTY_BYTE_ARRAY, EMPTY_OBJECT_ARRAY, EMPTY_OBJECT_ARRAY, EMPTY_OBJECT_ARRAY, EMPTY_OBJECT_ARRAY, EMPTY_OBJECT_ARRAY, |
| 1503 | + filename, funcname, lineno, EMPTY_BYTE_ARRAY); |
| 1504 | + PFrame frame = factory().createPFrame(null, code, factory().createDict(), factory().createDict()); |
| 1505 | + pyTraceBackHereNode.execute(null, frame); |
| 1506 | + return PNone.NONE; |
| 1507 | + } |
| 1508 | + } |
| 1509 | + |
1491 | 1510 | @Builtin(name = "PyTruffle_Set_SulongType", minNumOfPositionalArgs = 2)
|
1492 | 1511 | @GenerateNodeFactory
|
1493 | 1512 | abstract static class PyTruffle_Set_SulongType extends NativeBuiltin {
|
@@ -2879,7 +2898,7 @@ abstract static class CastArgsNode extends Node {
|
2879 | 2898 | @SuppressWarnings("unused")
|
2880 | 2899 | static Object[] doNull(VirtualFrame frame, Object argsObj,
|
2881 | 2900 | @Shared("lib") @CachedLibrary(limit = "3") InteropLibrary lib) {
|
2882 |
| - return PythonUtils.EMPTY_OBJECT_ARRAY; |
| 2901 | + return EMPTY_OBJECT_ARRAY; |
2883 | 2902 | }
|
2884 | 2903 |
|
2885 | 2904 | @Specialization(guards = "!lib.isNull(argsObj)")
|
@@ -4068,14 +4087,14 @@ static GetSetDescriptor createGetSet(String name, Object clazz, Object getter, O
|
4068 | 4087 | PBuiltinFunction get = null;
|
4069 | 4088 | if (!interopLibrary.isNull(getter)) {
|
4070 | 4089 | RootCallTarget getterCT = getterCallTarget(name, language);
|
4071 |
| - get = factory.createGetSetBuiltinFunction(name, cls, PythonUtils.EMPTY_OBJECT_ARRAY, ExternalFunctionNodes.createKwDefaults(getter, closure), getterCT); |
| 4090 | + get = factory.createGetSetBuiltinFunction(name, cls, EMPTY_OBJECT_ARRAY, ExternalFunctionNodes.createKwDefaults(getter, closure), getterCT); |
4072 | 4091 | }
|
4073 | 4092 |
|
4074 | 4093 | PBuiltinFunction set = null;
|
4075 | 4094 | boolean hasSetter = !interopLibrary.isNull(setter);
|
4076 | 4095 | if (hasSetter) {
|
4077 | 4096 | RootCallTarget setterCT = setterCallTarget(name, language);
|
4078 |
| - set = factory.createGetSetBuiltinFunction(name, cls, PythonUtils.EMPTY_OBJECT_ARRAY, ExternalFunctionNodes.createKwDefaults(setter, closure), setterCT); |
| 4097 | + set = factory.createGetSetBuiltinFunction(name, cls, EMPTY_OBJECT_ARRAY, ExternalFunctionNodes.createKwDefaults(setter, closure), setterCT); |
4079 | 4098 | }
|
4080 | 4099 |
|
4081 | 4100 | // create get-set descriptor
|
@@ -4350,7 +4369,7 @@ Object doGeneric(Object clsPtr,
|
4350 | 4369 | Object realSizeObj = readRealSizeNode.execute(cls, StructSequence.N_FIELDS);
|
4351 | 4370 | Object res;
|
4352 | 4371 | if (realSizeObj == PNone.NO_VALUE) {
|
4353 |
| - PRaiseNativeNode.raiseNative(null, SystemError, ErrorMessages.BAD_ARG_TO_INTERNAL_FUNC, PythonUtils.EMPTY_OBJECT_ARRAY, getRaiseNode(), transformExceptionToNativeNode); |
| 4372 | + PRaiseNativeNode.raiseNative(null, SystemError, ErrorMessages.BAD_ARG_TO_INTERNAL_FUNC, EMPTY_OBJECT_ARRAY, getRaiseNode(), transformExceptionToNativeNode); |
4354 | 4373 | res = getNativeNullNode.execute();
|
4355 | 4374 | } else {
|
4356 | 4375 | int realSize = castToIntNode.execute(realSizeObj);
|
|
0 commit comments