[llvm-branch-commits] [lldb] [lldb] Fix existing operators on lldb.value (PR #214297)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Aug 7 03:16:59 PDT 2026


================
@@ -431,10 +431,10 @@ class value(object):
         return int(self) % int(other)
 
     def __divmod__(self, other):
-        return int(self) % int(other)
+        return divmod(int(self), int(other))
----------------
Nerixyz wrote:

`__divmod__` is called to implement the [`divmod`](https://docs.python.org/3/library/functions.html#divmod) operation. So it should have the same return type as `divmod`:
> Take two (non-complex) numbers as arguments and return a pair of numbers consisting of their quotient and remainder when using integer division.

` a % b` only returns the remainder, not a tuple.

https://github.com/llvm/llvm-project/pull/214297


More information about the llvm-branch-commits mailing list