[PyQt] [PATCH v2 6/6] Use SIP_NULLPTR if arg type is a object pointer

Stefan BrĂ¼ns stefan.bruens at rwth-aachen.de
Mon Oct 1 02:58:49 BST 2018


Create value matching type from generateNamedBaseType(...), i.e. use
SIP_NULLPTR for PyObject*.
---
 sipgen/gencode.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/sipgen/gencode.c b/sipgen/gencode.c
index 7ea85f5..a89a6ef 100644
--- a/sipgen/gencode.c
+++ b/sipgen/gencode.c
@@ -7622,7 +7622,23 @@ static void generateCastZero(argDef *ad, FILE *fp)
         prcode(fp, "(%E)", ed);
     }
 
-    prcode(fp, "0");
+    switch (ad->atype)
+    {
+    case pyobject_type:
+    case pytuple_type:
+    case pylist_type:
+    case pydict_type:
+    case pycallable_type:
+    case pyslice_type:
+    case pytype_type:
+    case pybuffer_type:
+    case qobject_type:
+    case ellipsis_type:
+        prcode(fp, "SIP_NULLPTR");
+        break;
+    default:
+        prcode(fp, "0");
+    }
 }
 
 
-- 
2.19.0



More information about the PyQt mailing list