Hi Gudjon!

On Mon, Jul 13, 2020 at 08:46:34AM +0200, Gudjon I. Gudjonsson wrote:
> I have created an upstream branch, sip5
> https://github.com/GauiStori/PyQt-Qwt

Thanks for your efforts!

> But I get a compilation error.
>
> /home/gudjon/project_git/github/PyQt-Qwt/sip/conversions.sip:36:40: error: 
> ‘sipFindMappedType’ was not declared in this scope; did you mean 
> ‘sipMappedType’?
>    36 |   const sipMappedType* qvector_qreal = 
> sipFindMappedType("QVector<qreal>");
>       |                                        ^~~~~~~~~~~~~~~~~
>       |                                        sipMappedType
> /home/gudjon/project_git/github/PyQt-Qwt/sip/conversions.sip:45:12: error: 
> ‘sipCanConvertToMappedType’ was not declared in this scope; did you mean 
> ‘sipCanConvertToType’?
>    45 |       if (!sipCanConvertToMappedType(PyList_GET_ITEM(sipPy, i), 
> qvector_qreal, SIP_NOT_NONE))
>       |            ^~~~~~~~~~~~~~~~~~~~~~~~~
>       |            sipCanConvertToType

sip*MappedType functions are deprecated for a long time, since SIP v4.8.

See the following links (in python-sip-doc package):

- file:///usr/share/doc/python-sip-doc/html/c_api.html#c.sipFindMappedType
- 
file:///usr/share/doc/python-sip-doc/html/c_api.html#c.sipConvertFromMappedType
- 
file:///usr/share/doc/python-sip-doc/html/c_api.html#c.sipCanConvertToMappedType
...

You should replace them with sip*Type functions (as compiler suggests).

The attached patch makes the code compile, but I have not tested whether
it works correctly.

--
Dmitry Shachnev
diff --git a/sip/conversions.sip b/sip/conversions.sip
index 686fdda..f6077b9 100644
--- a/sip/conversions.sip
+++ b/sip/conversions.sip
@@ -12,7 +12,7 @@
   if ((l = PyList_New(sipCpp->size())) == NULL)
     return NULL;
 
-  const sipMappedType* qvector_qreal = sipFindMappedType("QVector<qreal>");
+  const sipTypeDef* qvector_qreal = sipFindType("QVector<qreal>");
 
   // Set the list elements.
   for (int i = 0; i < sipCpp->size(); ++i)
@@ -20,7 +20,7 @@
     QVector<qreal>* t = new QVector<qreal>(sipCpp->at(i));
     PyObject *tobj;
 
-    if ((tobj = sipConvertFromMappedType(t, qvector_qreal, sipTransferObj)) == NULL)
+    if ((tobj = sipConvertFromType(t, qvector_qreal, sipTransferObj)) == NULL)
     {
       Py_DECREF(l);
       delete t;
@@ -33,7 +33,7 @@
 %End
 
 %ConvertToTypeCode
-  const sipMappedType* qvector_qreal = sipFindMappedType("QVector<qreal>");
+  const sipTypeDef* qvector_qreal = sipFindType("QVector<qreal>");
 
   // Check the type if that is all that is required.
   if (sipIsErr == NULL)
@@ -42,7 +42,7 @@
       return 0;
 
     for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i)
-      if (!sipCanConvertToMappedType(PyList_GET_ITEM(sipPy, i), qvector_qreal, SIP_NOT_NONE))
+      if (!sipCanConvertToType(PyList_GET_ITEM(sipPy, i), qvector_qreal, SIP_NOT_NONE))
         return 0;
 
     return 1;
@@ -55,16 +55,16 @@
   {
     int state;
     //qreal *t = reinterpret_cast<qreal *>(sipConvertToInstance(PyList_GET_ITEM(sipPy, i), sipClass_qreal, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
-    QVector<qreal> * t = reinterpret_cast< QVector<qreal> * >(sipConvertToMappedType(PyList_GET_ITEM(sipPy, i), qvector_qreal, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
+    QVector<qreal> * t = reinterpret_cast< QVector<qreal> * >(sipConvertToType(PyList_GET_ITEM(sipPy, i), qvector_qreal, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
 
     if (*sipIsErr)
     {
-      sipReleaseMappedType(t, qvector_qreal, state);
+      sipReleaseType(t, qvector_qreal, state);
       delete ql;
       return 0;
     }
     ql->append(*t);
-    sipReleaseMappedType(t, qvector_qreal, state);
+    sipReleaseType(t, qvector_qreal, state);
   }
 
   *sipCppPtr = ql;

Attachment: signature.asc
Description: PGP signature

Reply via email to