Ticket #51149: patch-sip.diff
File patch-sip.diff, 1.7 KB (added by aaschwanden (Andy Aschwanden), 9 years ago) |
---|
-
conversions.sip
old new 680 680 PyObject *kobj, *tobj, *kobj2, *tobj2; 681 681 Py_ssize_t i = 0; 682 682 683 //TODO: it works using SIP684 #if (SIP_VERSION >= 0x041200)685 const sipMappedType* qmap2 = sipFindMappedType("QMap<int, TYPE>");686 #endif687 688 683 // Check the type if that is all that is required. 689 684 if (sipIsErr == NULL) 690 685 { … … 696 691 if (!PyDict_Check(tobj)) 697 692 return 0; 698 693 699 #if (SIP_VERSION >= 0x041200)700 if (!sipCanConvertToMappedType(tobj, qmap2, SIP_NOT_NONE))701 return 0;702 #else703 694 Py_ssize_t j = 0; 704 695 while (PyDict_Next(tobj, &j, &kobj2, &tobj2)) 705 696 { 706 697 if (!sipCanConvertToType(tobj2, sipType_TYPE, SIP_NOT_NONE)) 707 698 return 0; 708 699 } 709 #endif710 700 } 711 701 return 1; 712 702 } … … 717 707 { 718 708 qint64 k = PyLong_AsLongLong(kobj); 719 709 720 #if (SIP_VERSION >= 0x041200)721 // TODO: search for the minimum SIP version this code works on, it works722 // on SIP 4.13.3 (GS). See #else to know why the version check is needed.723 724 int state;725 726 TYPE* t = reinterpret_cast<TYPE*>(sipConvertToMappedType(tobj, qmap2, sipTransferObj,SIP_NOT_NONE,&state,sipIsErr));727 728 if (*sipIsErr)729 {730 sipReleaseMappedType(t, qmap2, state);731 delete qm;732 return 0;733 }734 735 qm.insert(k, *t);736 sipReleaseMappedType(t, qmap2, state);737 #else738 710 // using sipConvertToMappedType to convert directly to QMap<int, TYPE> doesn't work 739 711 // and ends with a segfault 740 712 … … 759 731 sipReleaseType(t2, sipType_TYPE, state); 760 732 } 761 733 qm->insert(k, qm2); 762 #endif763 734 } 764 735 765 736 *sipCppPtr = qm;