py: Change MP_UNARY_OP_INT to MP_UNARY_OP_INT_MAYBE.

To be consistent with MP_UNARY_OP_INT_FLOAT and MP_UNARY_OP_INT_COMPLEX,
and allow int() to first check if a type supports __int__ before trying
other things (as per CPython).

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2023-05-25 10:57:08 +10:00
parent 3ae78e803b
commit 48ffd6596e
11 changed files with 50 additions and 39 deletions

View File

@@ -0,0 +1,8 @@
# Test class special methods, that use a bigint.
class A:
def __int__(self):
return 1 << 100
print(int(A()))