Browse Source

interrogate: Support __truediv__, __floordiv__, etc. special methods

rdb 4 years ago
parent
commit
601ca323f5
1 changed files with 24 additions and 0 deletions
  1. 24 0
      dtool/src/interrogate/interfaceMakerPythonNative.cxx

+ 24 - 0
dtool/src/interrogate/interfaceMakerPythonNative.cxx

@@ -333,6 +333,18 @@ get_slotted_function_def(Object *obj, Function *func, FunctionRemap *remap,
     return true;
     return true;
   }
   }
 
 
+  if (method_name == "__truediv__") {
+    def._answer_location = "nb_true_divide";
+    def._wrapper_type = WT_binary_operator;
+    return true;
+  }
+
+  if (method_name == "__floordiv__") {
+    def._answer_location = "nb_floor_divide";
+    def._wrapper_type = WT_binary_operator;
+    return true;
+  }
+
   if (method_name == "operator %") {
   if (method_name == "operator %") {
     def._answer_location = "nb_remainder";
     def._answer_location = "nb_remainder";
     def._wrapper_type = WT_binary_operator;
     def._wrapper_type = WT_binary_operator;
@@ -405,6 +417,18 @@ get_slotted_function_def(Object *obj, Function *func, FunctionRemap *remap,
     return true;
     return true;
   }
   }
 
 
+  if (method_name == "__itruediv__") {
+    def._answer_location = "nb_inplace_true_divide";
+    def._wrapper_type = WT_binary_operator;
+    return true;
+  }
+
+  if (method_name == "__ifloordiv__") {
+    def._answer_location = "nb_inplace_floor_divide";
+    def._wrapper_type = WT_binary_operator;
+    return true;
+  }
+
   if (method_name == "operator %=") {
   if (method_name == "operator %=") {
     def._answer_location = "nb_inplace_remainder";
     def._answer_location = "nb_inplace_remainder";
     def._wrapper_type = WT_inplace_binary_operator;
     def._wrapper_type = WT_inplace_binary_operator;