Skip to content

Commit b375441

Browse files
committed
add thread_state->overflowed
1 parent 5220244 commit b375441

File tree

1 file changed

+18
-1
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext

1 file changed

+18
-1
lines changed

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public class PThreadState extends PythonNativeWrapper {
101101
public static final String DICT = "dict";
102102
public static final String PREV = "prev";
103103
public static final String RECURSION_DEPTH = "recursion_depth";
104+
public static final String OVERFLOWED = "overflowed";
104105

105106
private PDict dict;
106107

@@ -130,6 +131,7 @@ protected boolean isMemberReadable(String member) {
130131
case DICT:
131132
case PREV:
132133
case RECURSION_DEPTH:
134+
case OVERFLOWED:
133135
return true;
134136
default:
135137
return false;
@@ -139,7 +141,7 @@ protected boolean isMemberReadable(String member) {
139141
@ExportMessage
140142
protected Object getMembers(@SuppressWarnings("unused") boolean includeInternal,
141143
@Exclusive @Cached PythonObjectFactory factory) {
142-
return factory.createList(new Object[] { CUR_EXC_TYPE, CUR_EXC_VALUE, CUR_EXC_TRACEBACK, EXC_TYPE, EXC_VALUE, EXC_TRACEBACK, DICT, PREV, RECURSION_DEPTH });
144+
return factory.createList(new Object[] { CUR_EXC_TYPE, CUR_EXC_VALUE, CUR_EXC_TRACEBACK, EXC_TYPE, EXC_VALUE, EXC_TRACEBACK, DICT, PREV, RECURSION_DEPTH, OVERFLOWED });
143145
}
144146

145147
@ExportMessage
@@ -280,6 +282,11 @@ long doRecursionDepth(@SuppressWarnings("unused") String key) {
280282
return visitor.depth;
281283
}
282284

285+
@Specialization(guards = "eq(key, OVERFLOWED)")
286+
long doOverflowed(@SuppressWarnings("unused") String key) {
287+
return 0;
288+
}
289+
283290
protected static boolean eq(String key, String expected) {
284291
return expected.equals(key);
285292
}
@@ -303,6 +310,7 @@ protected boolean isMemberModifiable(String member) {
303310
case EXC_VALUE:
304311
case EXC_TRACEBACK:
305312
case RECURSION_DEPTH:
313+
case OVERFLOWED:
306314
return true;
307315
default:
308316
return false;
@@ -319,6 +327,8 @@ protected boolean isMemberInsertable(String member) {
319327
case EXC_TYPE:
320328
case EXC_VALUE:
321329
case EXC_TRACEBACK:
330+
case RECURSION_DEPTH:
331+
case OVERFLOWED:
322332
return true;
323333
default:
324334
return false;
@@ -422,6 +432,13 @@ Object doRecursionDepth(String key, int value) {
422432
return null;
423433
}
424434

435+
@Specialization(guards = "eq(key, OVERFLOWED)")
436+
@SuppressWarnings("unused")
437+
Object doOverflowed(String key, int value) {
438+
// TODO: (tfel) Can we not ignore this?
439+
return null;
440+
}
441+
425442
private static void setCurrentException(PRaiseNode raiseNode, PythonContext context, PBaseException exceptionObject) {
426443
try {
427444
throw raiseNode.raise(exceptionObject);

0 commit comments

Comments
 (0)