@@ -1050,11 +1050,14 @@ Object getItemsizeType(PythonBuiltinClassType cls, @SuppressWarnings("unused") P
1050
1050
static Object getItemsizeManaged (PythonManagedClass cls , @ SuppressWarnings ("unused" ) PNone value ,
1051
1051
@ Cached ("create()" ) IsBuiltinClassProfile profile ,
1052
1052
@ Cached ("create()" ) ReadAttributeFromObjectNode getName ) {
1053
+ Object itemsize ;
1053
1054
// recursion anchor; since the metaclass of 'type' is 'type'
1054
1055
if (profile .profileClass (cls , PythonBuiltinClassType .PythonClass )) {
1055
- return getName .execute (cls , TYPE_ITEMSIZE );
1056
+ itemsize = getName .execute (cls , TYPE_ITEMSIZE );
1057
+ } else {
1058
+ itemsize = getName .execute (cls , __ITEMSIZE__ );
1056
1059
}
1057
- return getName . execute ( cls , __ITEMSIZE__ ) ;
1060
+ return itemsize != PNone . NO_VALUE ? itemsize : 0 ;
1058
1061
}
1059
1062
1060
1063
@ Specialization (guards = "!isNoValue(value)" )
@@ -1098,11 +1101,14 @@ Object getBasicsizeType(PythonBuiltinClassType cls, @SuppressWarnings("unused")
1098
1101
static Object getBasicsizeManaged (PythonManagedClass cls , @ SuppressWarnings ("unused" ) PNone value ,
1099
1102
@ Cached ("create()" ) IsBuiltinClassProfile profile ,
1100
1103
@ Cached ("create()" ) ReadAttributeFromObjectNode getName ) {
1104
+ Object basicsize ;
1101
1105
// recursion anchor; since the metaclass of 'type' is 'type'
1102
1106
if (profile .profileClass (cls , PythonBuiltinClassType .PythonClass )) {
1103
- return getName .execute (cls , TYPE_BASICSIZE );
1107
+ basicsize = getName .execute (cls , TYPE_BASICSIZE );
1108
+ } else {
1109
+ basicsize = getName .execute (cls , __BASICSIZE__ );
1104
1110
}
1105
- return getName . execute ( cls , __BASICSIZE__ ) ;
1111
+ return basicsize != PNone . NO_VALUE ? basicsize : 0 ;
1106
1112
}
1107
1113
1108
1114
@ Specialization (guards = "!isNoValue(value)" )
0 commit comments