File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 40
40
*/
41
41
package com .oracle .graal .python .builtins .objects .type ;
42
42
43
- import static com .oracle .graal .python .builtins .PythonBuiltinClassType .PBaseException ;
44
43
import static com .oracle .graal .python .builtins .PythonBuiltinClassType .SystemError ;
45
44
import static com .oracle .graal .python .builtins .PythonBuiltinClassType .TypeError ;
46
45
import static com .oracle .graal .python .builtins .objects .cext .capi .NativeCAPISymbol .FUN_SUBCLASS_CHECK ;
@@ -2603,14 +2602,15 @@ static long lookup(Object cls,
2603
2602
}
2604
2603
2605
2604
private static int getBuiltinDictoffset (PythonBuiltinClassType cls ) {
2606
- // TODO properly specify for all builtin classes
2607
- PythonBuiltinClassType current = cls ;
2608
- do {
2609
- if (current == PBaseException ) {
2610
- return 16 ;
2611
- }
2612
- } while ((current = current .getBase ()) != null );
2613
- return 0 ;
2605
+ if (!cls .isBuiltinWithDict ()) {
2606
+ return 0 ;
2607
+ }
2608
+ // TODO there are more builtins with dict
2609
+ return switch (cls ) {
2610
+ case PBaseException , PythonModule -> 16 ;
2611
+ case PythonClass -> 264 ;
2612
+ default -> cls .getBase () != null ? getBuiltinDictoffset (cls .getBase ()) : 0 ;
2613
+ };
2614
2614
}
2615
2615
}
2616
2616
You can’t perform that action at this time.
0 commit comments