Salome HOME
upgraded swig support from v4.0.2 to v4.1.1 mbs/swig411 5/head
authormbs <martin.bernhard@opencascade.com>
Thu, 16 Mar 2023 19:22:42 +0000 (19:22 +0000)
committermbs <martin.bernhard@opencascade.com>
Thu, 16 Mar 2023 19:22:42 +0000 (19:22 +0000)
21 files changed:
src/CollectionAPI/CollectionAPI.i
src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py
src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py
src/FeaturesPlugin/Test/Test17000.py
src/FeaturesPlugin/Test/Test2738.py
src/FeaturesPlugin/Test/TestExtrusion.py
src/FiltersAPI/FiltersAPI.i
src/FiltersPlugin/FiltersPlugin_TopoConnectedFaces.py
src/GeomAlgoAPI/GeomAlgoAPI.i
src/ModelAPI/ModelAPI.i
src/ModelAPI/Test/Test2252.py
src/ModelHighAPI/ModelHighAPI.i
src/ParametersAPI/ParametersAPI.i
src/PythonAPI/model/roots.py
src/PythonAPI/model/tests/tests.py
src/PythonAddons/doc/examples/rectangle/feature.py
src/PythonAddons/macros/compoundVertices/feature.py
src/PythonAddons/macros/importParameters/feature.py
src/PythonAddons/macros/pipeNetwork/feature.py
src/PythonAddons/macros/rectangle/feature.py
src/SketchAPI/SketchAPI.i

index 60fb4e0cc2224816b2ef36c531ea3bb59b3e3665..4a815133b553fd8f3849c25f06700d863e582563 100644 (file)
 
 #endif // CollectionAPI_swig_H_
 
-  // fix for SWIG v2.0.4
-  #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj))
+// fix for SWIG v4.1.1
+#if PY_VERSION_HEX >= 0x03020000
+# define SWIGPY_SLICEOBJECT PyObject
+#else
+# define SWIGPY_SLICEOBJECT PySliceObject
+#endif
+
+// fix for SWIG v2.0.4
+#define SWIGPY_SLICE_ARG(obj)   ((SWIGPY_SLICEOBJECT*)(obj))
 %}
 
 %include "doxyhelp.i"
index 30e01b86ef0b9315fee681b8f79f560fa2da68bd..6802ff8a06526e8d5b2907e385b4ac06c20b5708 100644 (file)
@@ -61,9 +61,9 @@ class ExportFeature(ModelAPI.ModelAPI_Feature):
     def exportViaXAO(self):
         # if part-set is active, iterate also parts
         for isPart in (True, False):
-          aResultType = model.ModelAPI_ResultBody_group()
+          aResultType = model.ModelAPI_ResultBody.group()
           if isPart:
-            aResultType = model.ModelAPI_ResultPart_group()
+            aResultType = model.ModelAPI_ResultPart.group()
           # iterate all results of Part, export one by one due to issue 2882
           for aResIndex in range(self.Part.size(aResultType)):
             anObject = self.Part.object(aResultType, aResIndex)
index 1209adee9aa80c0e613aa14e30508d7de5992b5b..f36be7a06465cca1b66cd832d7b6ce98c5e6e4b5 100644 (file)
@@ -64,8 +64,8 @@ class PublishToStudyFeature(ModelAPI.ModelAPI_Feature):
         aPartSet = aSession.moduleDocument()
         # check that the PartSet document current feature is the last to avoid problems with all
         # features update
-        if aPartSet.size(model.ModelAPI_Feature_group()) > 0:
-          aLastFeature = ModelAPI.objectToFeature(aPartSet.object(model.ModelAPI_Feature_group(), aPartSet.size(model.ModelAPI_Feature_group()) - 1))
+        if aPartSet.size(model.ModelAPI_Feature.group()) > 0:
+          aLastFeature = ModelAPI.objectToFeature(aPartSet.object(model.ModelAPI_Feature.group(), aPartSet.size(model.ModelAPI_Feature.group()) - 1))
           aCurrentFeature = aPartSet.currentFeature(True)
           if aLastFeature.data().featureId() != aCurrentFeature.data().featureId():
             EventsAPI.Events_InfoMessage("PublishToStudy", "Not all PartSet parts are up-to-date, nothing is published. Please, make the last PartSet feature as current.", self).send()
@@ -78,8 +78,8 @@ class PublishToStudyFeature(ModelAPI.ModelAPI_Feature):
         allProcessed = []
 
         # iterate all parts and all results to publish them in SHAPER_STUDY
-        for aPartId in range(aPartSet.size(model.ModelAPI_ResultPart_group())):
-          aPartObject = aPartSet.object(model.ModelAPI_ResultPart_group(), aPartId)
+        for aPartId in range(aPartSet.size(model.ModelAPI_ResultPart.group())):
+          aPartObject = aPartSet.object(model.ModelAPI_ResultPart.group(), aPartId)
           aPartRes = ModelAPI.modelAPI_ResultPart(ModelAPI.modelAPI_Result(aPartObject))
           aPartDoc = aPartRes.partDoc()
           if aPartDoc is None and aPartObject is not None:
@@ -89,8 +89,8 @@ class PublishToStudyFeature(ModelAPI.ModelAPI_Feature):
           # Collects all features of exported results to find results of the same features and extend id.
           # Map from feature index to index of result. If index is zero (initial), no surrfix to entry is added.
           aFeaturesIndices = {}
-          for aResId in range(aPartDoc.size(model.ModelAPI_ResultBody_group())):
-            aResObject = aPartDoc.object(model.ModelAPI_ResultBody_group(), aResId)
+          for aResId in range(aPartDoc.size(model.ModelAPI_ResultBody.group())):
+            aResObject = aPartDoc.object(model.ModelAPI_ResultBody.group(), aResId)
             aRes = model.objectToResult(aResObject)
             #do not export images
             if aRes.hasTexture() is True:
index 53be1e52206bc2ee88460c0d382d7b5ae69959a0..ac0b2aaac75fca2aa01c5b86f1a04c111d7be1ea 100644 (file)
@@ -235,7 +235,7 @@ model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [499])
 
 import math
 from GeomAlgoAPI import *
-aResultArea = GeomAlgoAPI_ShapeTools_area(Partition_1.results()[0].resultSubShapePair()[0].shape())
+aResultArea = GeomAlgoAPI_ShapeTools.area(Partition_1.results()[0].resultSubShapePair()[0].shape())
 anExpectedArea = 70.18465
 assert(math.fabs(aResultArea-anExpectedArea)/anExpectedArea<1e-7)
 
index 240a26b22289605e6f62c0bc938683b0fb4957ae..899d4bede369e6d7411582d58a83855761e7cc00 100644 (file)
@@ -56,7 +56,7 @@ assert(selectionList.size() == 9)
 assert(aFactory.validate(Group_1.feature()))
 # checkthat solids in the first group are small, like the origin
 for i in range(9):
-  delta = GeomAlgoAPI_ShapeTools_volume(selectionList.value(i).value()) - 8.236773528312948
+  delta = GeomAlgoAPI_ShapeTools.volume(selectionList.value(i).value()) - 8.236773528312948
   assert(fabs(delta) < 1.e-5)
 
 # same-plane faces should be merged
@@ -66,7 +66,7 @@ assert(aFactory.validate(Group_2.feature()))
 
 # checkthat solids in the secong group are big, like the origin
 for i in range(9):
-  delta = GeomAlgoAPI_ShapeTools_volume(selectionList.value(i).value()) - 150.66735294710597
+  delta = GeomAlgoAPI_ShapeTools.volume(selectionList.value(i).value()) - 150.66735294710597
   assert(fabs(delta) < 1.e-5)
 
 assert(model.checkPythonDump())
index fcab77f8feb7bdcff11c78b9e271973a1f09925d..282bf2b3d6c1f0dce9558ea20e2c6867d9048625 100644 (file)
@@ -160,7 +160,7 @@ assert (anExtrusionResult is not None)
 
 # Check extrusion volume
 aRefVolume = 100530.96491487337
-aResVolume = GeomAlgoAPI_ShapeTools_volume(anExtrusionResult.shape())
+aResVolume = GeomAlgoAPI_ShapeTools.volume(anExtrusionResult.shape())
 assert (math.fabs(aResVolume - aRefVolume) < 10 ** -5)
 
 #=========================================================================
index f0cbd83be42fb69823b08c2deb19f2209b656c64..0ace51f045483611facf97905edd7b66b53d1c87 100644 (file)
 %{
   #include "FiltersAPI_swig.h"
 
+  // fix for SWIG v4.1.1
+  #if PY_VERSION_HEX >= 0x03020000
+  # define SWIGPY_SLICEOBJECT PyObject
+  #else
+  # define SWIGPY_SLICEOBJECT PySliceObject
+  #endif
+
   // fix for SWIG v2.0.4
-  #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj))
+  #define SWIGPY_SLICE_ARG(obj)   ((SWIGPY_SLICEOBJECT*)(obj))
 %}
 
 %include "doxyhelp.i"
index aa7e5c5b57461a1e286cf24a97942e01bbfcbe6a..01b850ea6dacd4648e1773f70c231f175778b508 100644 (file)
@@ -102,8 +102,8 @@ class FiltersPlugin_TopoConnectedFaces(ModelAPI_Filter):
 
   def initAttributes(self, theArgs):
     """ Initializes arguments of a filter """
-    theArgs.initAttribute("Shape", ModelAPI_AttributeSelection_typeId())
-    theArgs.initAttribute("Propagation", ModelAPI_AttributeBoolean_typeId())
+    theArgs.initAttribute("Shape", ModelAPI_AttributeSelection.typeId())
+    theArgs.initAttribute("Propagation", ModelAPI_AttributeBoolean.typeId())
 
   def adjacentFaces(self, theFace, theMapSA, theShapeType, theApplicableFaces, theRecursive = True):
     """ Find all faces neighbour to theFace """
index 2524c6ce824671ec8a925c06a54f5af1ca0a5075..3e75454ea3787aea7d3ff048ba1a06938cde761b 100644 (file)
 %module GeomAlgoAPI
 %{
   #include "GeomAlgoAPI_swig.h"
+
+// fix for SWIG v4.1.1
+#if PY_VERSION_HEX >= 0x03020000
+# define SWIGPY_SLICEOBJECT PyObject
+#else
+# define SWIGPY_SLICEOBJECT PySliceObject
+#endif
+
+// fix for SWIG v2.0.4
+#define SWIGPY_SLICE_ARG(obj)   ((SWIGPY_SLICEOBJECT*)(obj))
 %}
 
 // import other modules
index 969ed7fd599502a0237efcb34cb5de7690747eba..dab4fac4c5e091bec1961a5d864bc06409a9a808 100644 (file)
 %{
   #include "ModelAPI_swig.h"
 
-  // fix for SWIG v2.0.4
-  #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj))
+  // fix for SWIG v4.1.1
+  #if PY_VERSION_HEX >= 0x03020000
+  # define SWIGPY_SLICEOBJECT PyObject
+  #else
+  # define SWIGPY_SLICEOBJECT PySliceObject
+  #endif
 
+  // fix for SWIG v2.0.4
+  #define SWIGPY_SLICE_ARG(obj)   ((SWIGPY_SLICEOBJECT*)(obj))
   #define SWIGPY_UNICODE_ARG(obj) ((PyObject*) (obj))
 %}
 
index 8df731fddacce043c0fcabcd730130ac97d11c9b..2a500a36a68b1c5cf13e1231a5ea4479e6d9abbf 100644 (file)
@@ -61,8 +61,8 @@ model.end()
 assert(partSet.size("Parts") == 1)
 resShape = modelAPI_Result(partSet.object("Parts", 0)).shape()
 # height of extrusion 90 / 2 + translation 100
-assert(GeomAlgoAPI_ShapeTools_centreOfMass(resShape).x() == 145)
+assert(GeomAlgoAPI_ShapeTools.centreOfMass(resShape).x() == 145)
 # rotated
-assert(floor(GeomAlgoAPI_ShapeTools_centreOfMass(resShape).z()) == -30)
+assert(floor(GeomAlgoAPI_ShapeTools.centreOfMass(resShape).z()) == -30)
 
 assert(model.checkPythonDump())
index 23eadeb9b64eaa117dde04d01f82eb616da6ab10..83464cbf3148710b12f8688b7b144bc4e92c4449 100644 (file)
 %{
   #include "ModelHighAPI_swig.h"
 
-  // fix for SWIG v2.0.4
-  #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj))
+  // fix for SWIG v4.1.1
+  #if PY_VERSION_HEX >= 0x03020000
+  # define SWIGPY_SLICEOBJECT PyObject
+  #else
+  # define SWIGPY_SLICEOBJECT PySliceObject
+  #endif
 
+  // fix for SWIG v2.0.4
+  #define SWIGPY_SLICE_ARG(obj)   ((SWIGPY_SLICEOBJECT*)(obj))
   #define SWIGPY_UNICODE_ARG(obj) ((PyObject*) (obj))
 %}
 
index 17c873cdc3fc8f453348826a48c2edff54d579bd..aa9376478921d1f3d66f9339272a48398c4e0b0f 100644 (file)
 %{
   #include "ParametersAPI_swig.h"
 
-  // fix for SWIG v2.0.4
-  #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj))
+  // fix for SWIG v4.1.1
+  #if PY_VERSION_HEX >= 0x03020000
+  # define SWIGPY_SLICEOBJECT PyObject
+  #else
+  # define SWIGPY_SLICEOBJECT PySliceObject
+  #endif
 
+  // fix for SWIG v2.0.4
+  #define SWIGPY_SLICE_ARG(obj)   ((SWIGPY_SLICEOBJECT*)(obj))
   #define SWIGPY_UNICODE_ARG(obj) ((PyObject*) (obj))
 %}
 
index d503eac997e8518ba4d028edb077fe8b9bcc42c4..f8f762bd779c9670e5c01828f15b1b618407c1bb 100644 (file)
@@ -33,7 +33,7 @@ class Feature(ModelAPI.ModelAPI_Feature):
     def addRealInput(self, inputid):
         """F.addRealInput(str) -- add real attribute"""
         self.data().addAttribute(inputid,
-                                 ModelAPI.ModelAPI_AttributeDouble_typeId())
+                                 ModelAPI.ModelAPI_AttributeDouble.typeId())
 
     def getRealInput(self, inputid):
         """F.getRealInput(str) -- get real value of the attribute"""
index 23e6844610cc01fe590c56fa1e2d5e371dad0891..0b49ac2a44d2535c5d9e47fbaf2181c13b0b1229 100644 (file)
@@ -69,14 +69,14 @@ def generateTests(theFeature, theFeatureName, theTestsList = []):
     aNbResults = len(theFeature.results())
     aResultsVolumes = []
     for anIndex in range(0, aNbResults):
-      aResultsVolumes.append(GeomAlgoAPI_ShapeTools_volume(theFeature.results()[anIndex].resultSubShapePair()[0].shape()))
+      aResultsVolumes.append(GeomAlgoAPI_ShapeTools.volume(theFeature.results()[anIndex].resultSubShapePair()[0].shape()))
     print("model.testResultsVolumes({}, [{}])".format(theFeatureName, ", ".join("{:0.27f}".format(i) for i in aResultsVolumes)))
 
   if "testResultsAreas" in theTestsList or len(theTestsList) == 0:
     aNbResults = len(theFeature.results())
     aResultsAreas = []
     for anIndex in range(0, aNbResults):
-      aResultsAreas.append(GeomAlgoAPI_ShapeTools_area(theFeature.results()[anIndex].resultSubShapePair()[0].shape()))
+      aResultsAreas.append(GeomAlgoAPI_ShapeTools.area(theFeature.results()[anIndex].resultSubShapePair()[0].shape()))
     print("model.testResultsAreas({}, [{}])".format(theFeatureName, ", ".join("{:0.27f}".format(i) for i in aResultsAreas)))
 
 
@@ -191,7 +191,7 @@ def testResultsVolumes(theFeature, theExpectedResultsVolumes, theNbSignificantDi
   aListSize = len(theExpectedResultsVolumes)
   assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize)
   for anIndex in range(0, aNbResults):
-    aResultVolume = GeomAlgoAPI_ShapeTools_volume(theFeature.results()[anIndex].resultSubShapePair()[0].shape())
+    aResultVolume = GeomAlgoAPI_ShapeTools.volume(theFeature.results()[anIndex].resultSubShapePair()[0].shape())
     aResultVolumeStr = "{:0.27f}".format(aResultVolume).lstrip("0").lstrip(".").lstrip("0")
     anExpectedResultVolume = theExpectedResultsVolumes[anIndex]
     anExpectedResultVolumeStr = "{:0.27f}".format(anExpectedResultVolume).lstrip("0").lstrip(".").lstrip("0")
@@ -208,7 +208,7 @@ def testResultsAreas(theFeature, theExpectedResultsVolumes, theNbSignificantDigi
   aListSize = len(theExpectedResultsVolumes)
   assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize)
   for anIndex in range(0, aNbResults):
-    aResultVolume = GeomAlgoAPI_ShapeTools_area(theFeature.results()[anIndex].resultSubShapePair()[0].shape())
+    aResultVolume = GeomAlgoAPI_ShapeTools.area(theFeature.results()[anIndex].resultSubShapePair()[0].shape())
     aResultVolumeStr = "{:0.27f}".format(aResultVolume).lstrip("0").lstrip(".").lstrip("0")
     anExpectedResultVolume = theExpectedResultsVolumes[anIndex]
     anExpectedResultVolumeStr = "{:0.27f}".format(anExpectedResultVolume).lstrip("0").lstrip(".").lstrip("0")
index d213abb6dc063c4f043c00204129c159acf47b97..bd8a45e7decf3de6b28663dc53b38c0206f5bc19 100755 (executable)
@@ -74,12 +74,12 @@ class SketchPlugin_Rectangle(model.Feature):
     def initAttributes(self):
         """Override Feature.initAttributes()"""
         # Flag whether the rectangle is accessory
-        self.data().addAttribute(self.AUXILIARY_ID(), ModelAPI.ModelAPI_AttributeBoolean_typeId())
+        self.data().addAttribute(self.AUXILIARY_ID(), ModelAPI.ModelAPI_AttributeBoolean.typeId())
         # Creating corners of the rectangle
-        self.data().addAttribute(self.START_ID(), GeomDataAPI.GeomDataAPI_Point2D_typeId())
-        self.data().addAttribute(self.END_ID(), GeomDataAPI.GeomDataAPI_Point2D_typeId())
+        self.data().addAttribute(self.START_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId())
+        self.data().addAttribute(self.END_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId())
         # Creating list to store lines
-        self.data().addAttribute(self.LINES_LIST_ID(), ModelAPI.ModelAPI_AttributeRefList_typeId())
+        self.data().addAttribute(self.LINES_LIST_ID(), ModelAPI.ModelAPI_AttributeRefList.typeId())
         ModelAPI.ModelAPI_Session.get().validators().registerNotObligatory(self.getKind(), self.LINES_LIST_ID())
 
     def isMacro(self):
index 06733ab10a88e746bb709b143c7ef592183c697a..157341ac4659a73fad419e11d8914a01f9d19e08 100755 (executable)
@@ -60,8 +60,8 @@ class compoundVertices(model.Feature):
     def initAttributes(self):
         """Override Feature.initAttributes()"""
         # Creating the input argument of the feature
-        self.data().addAttribute(self.FILE_ID(), ModelAPI.ModelAPI_AttributeString_typeId())
-        self.data().addAttribute(self.SEPARATOR_ID(), ModelAPI.ModelAPI_AttributeString_typeId())
+        self.data().addAttribute(self.FILE_ID(), ModelAPI.ModelAPI_AttributeString.typeId())
+        self.data().addAttribute(self.SEPARATOR_ID(), ModelAPI.ModelAPI_AttributeString.typeId())
 
         self.lfeatures = []
         self.folder = None
index 20b508f83eba50509dbd90b8d680278e65253d10..eff86738922b4b376b1128e76a692d9eaa353895 100755 (executable)
@@ -56,7 +56,7 @@ class importParameters(model.Feature):
     def initAttributes(self):
         """Override Feature.initAttributes()"""
         # Creating the input argument of the feature
-        self.data().addAttribute(self.FILE_ID(), ModelAPI.ModelAPI_AttributeString_typeId())
+        self.data().addAttribute(self.FILE_ID(), ModelAPI.ModelAPI_AttributeString.typeId())
 
 
 # Get existing parameters names
index 86e9bcdc495a754148918819876592fbe78696fa..005e2bed6878a4c2323a7f7e5f5a3e84c0f1420d 100755 (executable)
@@ -94,8 +94,8 @@ class pipeNetwork(model.Feature):
     def initAttributes(self):
         """Override Feature.initAttributes()"""
         # Creating the input argument of the feature
-        self.data().addAttribute(self.FILE_ID(), ModelAPI.ModelAPI_AttributeString_typeId())
-        #self.data().addAttribute(self.HEXAS_ID(), ModelAPI.ModelAPI_AttributeBoolean_typeId())
+        self.data().addAttribute(self.FILE_ID(), ModelAPI.ModelAPI_AttributeString.typeId())
+        #self.data().addAttribute(self.HEXAS_ID(), ModelAPI.ModelAPI_AttributeBoolean.typeId())
 
 #====================================================================================
 # Retrieve parent pipe
index 747664f0b6fc1447c5d312f55364f7d6f39f577d..090d40afce0ea1c9963687bbf67a3cba317295dc 100755 (executable)
@@ -105,20 +105,20 @@ class SketchPlugin_Rectangle(model.Feature):
     def initAttributes(self):
         """Override Feature.initAttributes()"""
         # Flag whether the rectangle is accessory
-        self.data().addAttribute(self.AUXILIARY_ID(), ModelAPI.ModelAPI_AttributeBoolean_typeId())
+        self.data().addAttribute(self.AUXILIARY_ID(), ModelAPI.ModelAPI_AttributeBoolean.typeId())
         # Creating corners of the rectangle
-        self.data().addAttribute(self.START_ID(), GeomDataAPI.GeomDataAPI_Point2D_typeId())
-        self.data().addAttribute(self.END_ID(), GeomDataAPI.GeomDataAPI_Point2D_typeId())
+        self.data().addAttribute(self.START_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId())
+        self.data().addAttribute(self.END_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId())
         # Creating list to store lines
-        self.data().addAttribute(self.LINES_LIST_ID(), ModelAPI.ModelAPI_AttributeRefList_typeId())
+        self.data().addAttribute(self.LINES_LIST_ID(), ModelAPI.ModelAPI_AttributeRefList.typeId())
         ModelAPI.ModelAPI_Session.get().validators().registerNotObligatory(self.getKind(), self.LINES_LIST_ID())
         # Type of rectangle
-        self.data().addAttribute(self.RECTANGLE_TYPE_ID(), ModelAPI.ModelAPI_AttributeString_typeId())
+        self.data().addAttribute(self.RECTANGLE_TYPE_ID(), ModelAPI.ModelAPI_AttributeString.typeId())
         # Center and corner of the rectangle
-        self.data().addAttribute(self.CENTER_ID(), GeomDataAPI.GeomDataAPI_Point2D_typeId())
-        self.data().addAttribute(self.CORNER_ID(), GeomDataAPI.GeomDataAPI_Point2D_typeId())
+        self.data().addAttribute(self.CENTER_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId())
+        self.data().addAttribute(self.CORNER_ID(), GeomDataAPI.GeomDataAPI_Point2D.typeId())
 
-        self.data().addAttribute(self.CENTER_REF_ID(), ModelAPI.ModelAPI_AttributeRefAttr_typeId())
+        self.data().addAttribute(self.CENTER_REF_ID(), ModelAPI.ModelAPI_AttributeRefAttr.typeId())
         ModelAPI.ModelAPI_Session.get().validators().registerNotObligatory(self.getKind(), self.CENTER_REF_ID())
 
     def isMacro(self):
index cc87fa94af34e26dad0e20e4fb5a5a36e5e73e6b..a4cbce863455077b3f426377cd35eabbc31dfe5c 100644 (file)
   #include "SketchAPI_swig.h"
   #include "ModelHighAPI_swig.h"
 
-  // fix for SWIG v2.0.4
-  #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj))
+  // fix for SWIG v4.1.1
+  #if PY_VERSION_HEX >= 0x03020000
+  # define SWIGPY_SLICEOBJECT PyObject
+  #else
+  # define SWIGPY_SLICEOBJECT PySliceObject
+  #endif
 
+  // fix for SWIG v2.0.4
+  #define SWIGPY_SLICE_ARG(obj)   ((SWIGPY_SLICEOBJECT*)(obj))
   #define SWIGPY_UNICODE_ARG(obj) ((PyObject*) (obj))
 %}