mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 20:50:14 +01:00
py/modbuiltins: Implement abs() by dispatching to MP_UNARY_OP_ABS.
This allows user classes to implement __abs__ special method, and saves code size (104 bytes for x86_64), even though during refactor, an issue was fixed and few optimizations were made: * abs() of minimum (negative) small int value is calculated properly. * objint_longlong and objint_mpz avoid allocating new object is the argument is already non-negative.
This commit is contained in:
@@ -38,7 +38,7 @@ ementation
|
||||
0
|
||||
0
|
||||
# runtime utils
|
||||
TypeError: can't convert str to int
|
||||
TypeError: unsupported type for : 'str'
|
||||
TypeError: unsupported types for : 'str', 'str'
|
||||
Warning: test
|
||||
# format float
|
||||
|
||||
Reference in New Issue
Block a user