Skip to content

Commit 805b7cd

Browse files
committed
[GR-10277] Instances of an extended class from int doesn't have right type.
1 parent 924de16 commit 805b7cd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/BuiltinConstructors.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ public Object createInt(PythonClass cls, PythonObject obj, PNone keywordArg,
710710
return createInt(cls, (long) result, keywordArg, isIntProfile);
711711
} else if (result instanceof PInt) {
712712
// TODO warn if 'result' not of exact Python type 'int'
713-
return result;
713+
return isPrimitiveInt(cls) ? result : factory().createInt(cls, ((PInt) result).getValue());
714714
} else {
715715
throw raise(TypeError, "__int__ returned non-int (type %p)", result);
716716
}

0 commit comments

Comments
 (0)