Browse Source

interrogate: support __int__ -> nb_int slot mapping

rdb 5 years ago
parent
commit
a34867ae4f
1 changed files with 7 additions and 0 deletions
  1. 7 0
      dtool/src/interrogate/interfaceMakerPythonNative.cxx

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

@@ -104,6 +104,7 @@ RenameSet methodRenameDictionary[] = {
   { "operator >>="  , "__irshift__",            1 },
   { "operator typecast bool", "__nonzero__",    0 },
   { "__nonzero__"   , "__nonzero__",            0 },
+  { "__int__"       , "__int__",                0 },
   { "__reduce__"    , "__reduce__",             0 },
   { "__reduce_persist__", "__reduce_persist__", 0 },
   { "__copy__"      , "__copy__",               0 },
@@ -557,6 +558,12 @@ get_slotted_function_def(Object *obj, Function *func, FunctionRemap *remap,
     return true;
   }
 
+  if (method_name == "__int__") {
+    def._answer_location = "nb_int";
+    def._wrapper_type = WT_no_params;
+    return true;
+  }
+
   if (method_name == "__getbuffer__") {
     def._answer_location = "bf_getbuffer";
     def._wrapper_type = WT_getbuffer;