about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorwoni <81616747+W0ni@users.noreply.github.com>2024-08-19 20:50:18 +0200
committerwoni <81616747+W0ni@users.noreply.github.com>2024-08-19 20:55:10 +0200
commit0dfc5505348b2ca40e0d94be07e322ecf3c73c71 (patch)
treea11583cd3ed9c018439e872022bea6ac52800632
parent1ba37c39b1fa70651a1c7748c5829656cd3e6dea (diff)
downloadfocaccia-miasm-0dfc5505348b2ca40e0d94be07e322ecf3c73c71.tar.gz
focaccia-miasm-0dfc5505348b2ca40e0d94be07e322ecf3c73c71.zip
fix expression division and add test
-rw-r--r--miasm/expression/expression.py4
-rw-r--r--test/expression/expression.py6
2 files changed, 8 insertions, 2 deletions
diff --git a/miasm/expression/expression.py b/miasm/expression/expression.py
index e5debb34..4b0bbe6b 100644
--- a/miasm/expression/expression.py
+++ b/miasm/expression/expression.py
@@ -568,11 +568,11 @@ class Expr(object):
     def __sub__(self, other):
         return ExprOp('+', self, ExprOp('-', other))
 
-    def __div__(self, other):
+    def __truediv__(self, other):
         return ExprOp('/', self, other)
 
     def __floordiv__(self, other):
-        return self.__div__(other)
+        return self.__truediv__(other)
 
     def __mod__(self, other):
         return ExprOp('%', self, other)
diff --git a/test/expression/expression.py b/test/expression/expression.py
index 9b0c2807..fa3cf0f7 100644
--- a/test/expression/expression.py
+++ b/test/expression/expression.py
@@ -80,16 +80,22 @@ assert mem.get_r(mem_read=True) == set([mem, A])
 
 C = A+B
 D = C + A
+E = A / B
+F = A // B
+assert E is F
 
 assert A in A
 assert A in C
 assert B in C
 assert C in C
+assert E in E
 
 assert A in D
 assert B in D
 assert C in D
 assert D in D
+assert A in E
+assert B in E
 
 assert C not in A
 assert C not in B