Commits

Jörg Rädler  committed 44bade9

version 3.0.5,
fix some data types to work with numpy and prevent warnings,
fix warning in gpfInfo()

  • Participants
  • Parent commits 7f1ff09
  • Tags v3.0.5

Comments (0)

Files changed (4)

+03.07.12
+- version 3.0.5
+- changed some data types to prevent warnings
+- fixed numpy interface
+- numpy support is switched on by default now
+- fixed warning in gpfInfo()
+
 30.03.11
 - version 3.0.4
 - fixed a bug in writeSVG()

File Polygon/Utils.py

                 holes += int(f.readline())
         [ f.readline() for p in range(pp-x) ]
         points += pp
-
+    f.close()
     return contours, holes, points, withHoles
 #  * faster adding of contours from NumPy arrays
 #  * data style STYLE_NUMPY to get contours and TriStrips
 #    as NumPy arrays
-withNumPy=False
+withNumPy=True
 
 # if withNumPy is True, set the include path for numpy/arrayobject.h
 # the example is for python on Windows:
 
 args = { 
     'name'            : "Polygon",
-    'version'         : "3.0.4",
+    'version'         : "3.0.5",
     'description'     : "Polygon is a python package that handles polygonal shapes in 2D",
     'long_description': longdesc,
     'license'         : "LGPL for Polygon, other for gpc",

File src/cPolygon.c

 #define INDEF INT_MAX
 
 #ifndef POLY_VERSION
-#define POLY_VERSION "3.0.4"
+#define POLY_VERSION "3.0.5"
 #endif
 
 #ifndef PyMODINIT_FUNC
 }
 
 
-static int Polygon_len(PyObject *self) {
+static Py_ssize_t Polygon_len(PyObject *self) {
     return ((Polygon *)self)->gpc_p->num_contours;
 }
 
 
-static PyObject *Polygon_getitem(PyObject *self, int item) {
+static PyObject *Polygon_getitem(PyObject *self, Py_ssize_t item) {
     PyObject *R;
     gpc_vertex_list * vl = NULL;
     gpc_vertex *v;
         } break;
 #ifdef WITH_NUMPY
         case STYLE_NUMPY: {
-            int dims[2] = {0, 2};
+            npy_intp dims[2] = {0, 2};
             PyArrayObject *a;
             dims[0] = imax; 
             R = PyArray_SimpleNew(2, dims, PyArray_DOUBLE);
         } break;
 #ifdef WITH_NUMPY
         case STYLE_NUMPY: {
-            int dims[2] = {0, 2};
+            npy_intp dims[2] = {0, 2};
             R = PyTuple_New(t->num_strips);
             for (i=0; i < t->num_strips; i++) {
                 vl = t->strip + i;