|
From: <and...@us...> - 2008-12-15 09:56:35
|
Revision: 9111
http://plplot.svn.sourceforge.net/plplot/?rev=9111&view=rev
Author: andrewross
Date: 2008-12-15 09:56:32 +0000 (Mon, 15 Dec 2008)
Log Message:
-----------
Remove printf debugging message. This message is unnecessary and
generates a warning about incorrect type formats on a 64-bit machine.
Modified Paths:
--------------
trunk/bindings/python/plplotcmodule.i
Modified: trunk/bindings/python/plplotcmodule.i
===================================================================
--- trunk/bindings/python/plplotcmodule.i 2008-12-15 09:50:50 UTC (rev 9110)
+++ trunk/bindings/python/plplotcmodule.i 2008-12-15 09:56:32 UTC (rev 9111)
@@ -435,7 +435,6 @@
tmp = (PyArrayObject *)myArray_ContiguousFromObject($input, PyArray_PLFLT, 2, 2);
if(tmp == NULL) return NULL;
if(tmp->dimensions[0] != Xlen || tmp->dimensions[1] != Ylen) {
- printf("%d %d %d %d\n",tmp->dimensions[0],Xlen,tmp->dimensions[1],Ylen);
PyErr_SetString(PyExc_ValueError, "Vectors must match matrix.");
return NULL;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <and...@us...> - 2009-01-16 09:35:35
|
Revision: 9321
http://plplot.svn.sourceforge.net/plplot/?rev=9321&view=rev
Author: andrewross
Date: 2009-01-16 09:35:31 +0000 (Fri, 16 Jan 2009)
Log Message:
-----------
Fix incorrect variable name in python bindings. This would not stop
the bindings working, but may have resulted in memory not being freed.
Many thanks to Werner Smekal for spotting this.
Modified Paths:
--------------
trunk/bindings/python/plplotcmodule.i
Modified: trunk/bindings/python/plplotcmodule.i
===================================================================
--- trunk/bindings/python/plplotcmodule.i 2009-01-16 08:56:02 UTC (rev 9320)
+++ trunk/bindings/python/plplotcmodule.i 2009-01-16 09:35:31 UTC (rev 9321)
@@ -190,7 +190,7 @@
}
$1 = (PLINT*)tmp->data;
}
-%typemap(freearg) PLINT *ArrayCkMinus1 { Py_DECREF(tmp$argnum);}
+%typemap(freearg) PLINT *ArrayCkMinus1NULL { Py_DECREF(tmp$argnum);}
/* No length but remember size to check others */
%typemap(in) PLINT *Array (PyArrayObject* tmp) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <and...@us...> - 2009-01-16 11:11:58
|
Revision: 9323
http://plplot.svn.sourceforge.net/plplot/?rev=9323&view=rev
Author: andrewross
Date: 2009-01-16 11:11:54 +0000 (Fri, 16 Jan 2009)
Log Message:
-----------
Fix previous commit - should read Null not NULL.
Modified Paths:
--------------
trunk/bindings/python/plplotcmodule.i
Modified: trunk/bindings/python/plplotcmodule.i
===================================================================
--- trunk/bindings/python/plplotcmodule.i 2009-01-16 10:22:04 UTC (rev 9322)
+++ trunk/bindings/python/plplotcmodule.i 2009-01-16 11:11:54 UTC (rev 9323)
@@ -190,7 +190,7 @@
}
$1 = (PLINT*)tmp->data;
}
-%typemap(freearg) PLINT *ArrayCkMinus1NULL { Py_DECREF(tmp$argnum);}
+%typemap(freearg) PLINT *ArrayCkMinus1Null { Py_DECREF(tmp$argnum);}
/* No length but remember size to check others */
%typemap(in) PLINT *Array (PyArrayObject* tmp) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2009-08-19 08:16:33
|
Revision: 10294
http://plplot.svn.sourceforge.net/plplot/?rev=10294&view=rev
Author: smekal
Date: 2009-08-19 08:16:21 +0000 (Wed, 19 Aug 2009)
Log Message:
-----------
label_func declaration is wrong in my opinion, since it should return nothing. Should have no effect anyway, since label_func is not explicitely used in the SWIG files (only in the file generated by SWIG and here the declaration is correct).
Modified Paths:
--------------
trunk/bindings/python/plplotcmodule.i
Modified: trunk/bindings/python/plplotcmodule.i
===================================================================
--- trunk/bindings/python/plplotcmodule.i 2009-08-19 07:57:43 UTC (rev 10293)
+++ trunk/bindings/python/plplotcmodule.i 2009-08-19 08:16:21 UTC (rev 10294)
@@ -617,7 +617,7 @@
typedef void (*pltr_func)(PLFLT, PLFLT, PLFLT *, PLFLT*, PLPointer);
typedef void (*mapform_func)(PLINT, PLFLT *, PLFLT*);
typedef PLFLT (*f2eval_func)(PLINT, PLINT, PLPointer);
-typedef char * (*label_func)(PLINT, PLFLT, char *, PLINT, PLPointer);
+typedef void (*label_func)(PLINT, PLFLT, char *, PLINT, PLPointer);
%{
typedef PLINT (*defined_func)(PLFLT, PLFLT);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <and...@us...> - 2010-05-17 11:44:46
|
Revision: 11000
http://plplot.svn.sourceforge.net/plplot/?rev=11000&view=rev
Author: andrewross
Date: 2010-05-17 11:44:40 +0000 (Mon, 17 May 2010)
Log Message:
-----------
Tidy up of python mapform callback code and change to method of creating numpy arrays. Fixes up a deprecation warning with recent versions of numpy.
Modified Paths:
--------------
trunk/bindings/python/plplotcmodule.i
Modified: trunk/bindings/python/plplotcmodule.i
===================================================================
--- trunk/bindings/python/plplotcmodule.i 2010-05-17 11:39:36 UTC (rev 10999)
+++ trunk/bindings/python/plplotcmodule.i 2010-05-17 11:44:40 UTC (rev 11000)
@@ -840,7 +840,7 @@
/* build the argument list */
#ifdef HAVE_NUMPY
px = PyArray_SimpleNewFromData(1, &n, NPY_PLFLT,(void *)xt);
- py = PyArray_SimpleNewFromData(1, &n, NPY_PLFLT,(char *)yt);
+ py = PyArray_SimpleNewFromData(1, &n, NPY_PLFLT,(void *)yt);
#else
px = PyArray_FromDimsAndData(1, &n, PyArray_PLFLT,(char *)xt);
py = PyArray_FromDimsAndData(1, &n, PyArray_PLFLT,(char *)yt);
@@ -871,14 +871,18 @@
/* PyArrayObject *tmpx, *tmpy;
PLFLT *xx, *yy;
PLINT i; */
+#ifdef HAVE_NUMPY
+ npy_intp nn;
+ nn = n;
+#endif
if(python_mapform) { /* if not something is terribly wrong */
/* grab the Global Interpreter Lock to be sure threads don't mess us up */
MY_BLOCK_THREADS
/* build the argument list */
-#ifdef PL_DOUBLE
- px = PyArray_FromDimsAndData(1, &n, PyArray_DOUBLE,(char *)x);
- py = PyArray_FromDimsAndData(1, &n, PyArray_DOUBLE,(char *)y);
+#ifdef HAVE_PTHREAD
+ px = PyArray_SimpleNewFromData(1, &nn, NPY_PLFLT,(void *)x);
+ py = PyArray_SimpleNewFromData(1, &nn, NPY_PLFLT,(void *)y);
#else
px = PyArray_FromDimsAndData(1, &n, PyArray_FLOAT,(char *)x);
py = PyArray_FromDimsAndData(1, &n, PyArray_FLOAT,(char *)y);
@@ -894,24 +898,7 @@
if(result == NULL) {
fprintf(stderr, "call to python mapform function with 3 arguments failed\n");
PyErr_SetString(PyExc_RuntimeError, "mapform callback must take 3 arguments.");
- } /* else {
- PyArg_ParseTuple(result,"OO",&px,&py);
- PyArrayObject *tmpx = (PyArrayObject *)myArray_ContiguousFromObject(px, PyArray_PLFLT, 1, 1);
- PyArrayObject *tmpy = (PyArrayObject *)myArray_ContiguousFromObject(py, PyArray_PLFLT, 1, 1);
- if(tmpx == 0 || tmpy == 0 || tmpx->dimensions[0] != 1 ||tmpy->dimensions[0] != 1) {
- fprintf(stderr, "pltr callback must return a 1-D vector or sequence\n");
- PyErr_SetString(PyExc_RuntimeError, "pltr callback must return a 1-sequence.");
- } else {
- xx = (PLFLT*)tmpx->data;
- yy = (PLFLT*)tmpy->data;
- for (i=0;i<n;i++) {
- x[i] = xx[i];
- y[i] = yy[1];
- }
- Py_XDECREF(tmpx);
- Py_XDECREF(tmpy);
- }
- } */
+ }
/* release the result */
Py_XDECREF(result);
/* release the global interpreter lock */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ai...@us...> - 2011-01-12 01:11:48
|
Revision: 11487
http://plplot.svn.sourceforge.net/plplot/?rev=11487&view=rev
Author: airwin
Date: 2011-01-12 01:11:42 +0000 (Wed, 12 Jan 2011)
Log Message:
-----------
Fix typo that was causing documentation to be ignored for python.
Now under python, e.g.,
print ("%s" % plline.__doc__)
gives excellent detailed help results for plline consistent with
doc/docbook/src/api.xml.
Modified Paths:
--------------
trunk/bindings/python/plplotcmodule.i
Modified: trunk/bindings/python/plplotcmodule.i
===================================================================
--- trunk/bindings/python/plplotcmodule.i 2011-01-12 00:56:04 UTC (rev 11486)
+++ trunk/bindings/python/plplotcmodule.i 2011-01-12 01:11:42 UTC (rev 11487)
@@ -1293,7 +1293,7 @@
%pybuffer_mutable_string(void * plotmem)
#endif
-/* %feature commands supporting swig-generated documentation for the bindings. *.
+/* %feature commands supporting swig-generated documentation for the bindings. */
%include swig_documentation.i
/* swig-compatible PLplot API definitions from here on. */
%include plplotcapi.i
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ai...@us...> - 2013-10-19 03:27:53
|
Revision: 12606
http://sourceforge.net/p/plplot/code/12606
Author: airwin
Date: 2013-10-19 03:27:48 +0000 (Sat, 19 Oct 2013)
Log Message:
-----------
Replace PyArray_FLOAT type (which is not part of the clean numpy-1.7
API) with appropriate NPY_* style types.
This fixed the numpy-1.7.1 compile errors caused by
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
In two cases (both when calling a single-precision version of PLplot from python)
the PyArray_FLOAT replacement is by NPY_FLOAT32. That replacement
seemed appropriate but has not been tested.
In the two other cases (when PL_HAVE_PTHREAD is not #defined)
PyArray_FLOAT was replaced by NPY_PLFLT since I am pretty sure that
whether that macro is #defined or not should have nothing to do with
precision. This case (involving mapform) was tested on the
MinGW/MYSYS/Wine platform, and the results for example 19 were
substantially improved from major differences to just a few small
rounding troubles. So this change was definitely a bug fix
for the mapform case.
The remaining changes were to use a specific floating-point
precision types in all cases for clarity.
Modified Paths:
--------------
trunk/bindings/python/plplotcmodule.i
Modified: trunk/bindings/python/plplotcmodule.i
===================================================================
--- trunk/bindings/python/plplotcmodule.i 2013-10-19 02:51:19 UTC (rev 12605)
+++ trunk/bindings/python/plplotcmodule.i 2013-10-19 03:27:48 UTC (rev 12606)
@@ -53,9 +53,9 @@
#define NPY_PLINT NPY_INT32
#ifdef PL_DOUBLE
-#define NPY_PLFLT NPY_DOUBLE
+#define NPY_PLFLT NPY_FLOAT64
#else
-#define NPY_PLFLT NPY_FLOAT
+#define NPY_PLFLT NPY_FLOAT32
#endif
// python-1.5 compatibility mode?
@@ -271,7 +271,7 @@
// some really twisted stuff to allow calling a single precision library from python
PyArrayObject* myArray_ContiguousFromObject( PyObject* in, int type, int mindims, int maxdims )
{
- PyArrayObject* tmp = (PyArrayObject *) PyArray_ContiguousFromObject( in, PyArray_FLOAT,
+ PyArrayObject* tmp = (PyArrayObject *) PyArray_ContiguousFromObject( in, NPY_FLOAT32,
mindims, maxdims );
if ( !tmp )
{
@@ -279,7 +279,7 @@
if ( PyArray_Check( in ) )
{
PyErr_Clear();
- tmp = (PyArrayObject *) PyArray_Cast( (PyArrayObject *) in, PyArray_FLOAT );
+ tmp = (PyArrayObject *) PyArray_Cast( (PyArrayObject *) in, NPY_FLOAT32 );
}
}
return tmp;
@@ -604,7 +604,7 @@
// list and this ArrayY.
dims[0] = Xlen;
dims[1] = Ylen;
- array = PyArray_SimpleNew( 2, dims, NPY_DOUBLE );
+ array = PyArray_SimpleNew( 2, dims, NPY_FLOAT64 );
if ( !array )
return NULL;
size = (int) ( sizeof ( double ) * Ylen );
@@ -1130,8 +1130,8 @@
px = PyArray_SimpleNewFromData( 1, &nn, NPY_PLFLT, (void *) x );
py = PyArray_SimpleNewFromData( 1, &nn, NPY_PLFLT, (void *) y );
#else
- px = PyArray_FromDimsAndData( 1, &n, PyArray_FLOAT, (char *) x );
- py = PyArray_FromDimsAndData( 1, &n, PyArray_FLOAT, (char *) y );
+ px = PyArray_FromDimsAndData( 1, &n, NPY_PLFLT, (char *) x );
+ py = PyArray_FromDimsAndData( 1, &n, NPY_PLFLT, (char *) y );
#endif
arglist = Py_BuildValue( "(iOO)", n, px, py );
// call the python function
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <arj...@us...> - 2013-10-19 17:10:59
|
Revision: 12607
http://sourceforge.net/p/plplot/code/12607
Author: arjenmarkus
Date: 2013-10-19 17:10:54 +0000 (Sat, 19 Oct 2013)
Log Message:
-----------
Adjust the casts and sizes for calls to PyArray_DATA, as MSVC/C++ does not allow pointer arithmetic on (void *) pointers. By casting the result of PyArray_DATA to the proper data type the statements become acceptable and it is also no longer needed to multiply the stride with the size of the data type in bytes.
Modified Paths:
--------------
trunk/bindings/python/plplotcmodule.i
Modified: trunk/bindings/python/plplotcmodule.i
===================================================================
--- trunk/bindings/python/plplotcmodule.i 2013-10-19 03:27:48 UTC (rev 12606)
+++ trunk/bindings/python/plplotcmodule.i 2013-10-19 17:10:54 UTC (rev 12607)
@@ -477,10 +477,10 @@
}
$2 = PyArray_DIMS( tmp )[0];
$3 = PyArray_DIMS( tmp )[1];
- size = sizeof ( PLFLT ) * $3;
+ size = $3;
$1 = (PLFLT **) malloc( sizeof ( PLFLT* ) * $2 );
for ( i = 0; i < $2; i++ )
- $1[i] = (PLFLT *) ( PyArray_DATA( tmp ) + i * size );
+ $1[i] = ( (PLFLT *) PyArray_DATA( tmp ) + i * size );
}
%typemap( freearg ) ( const PLFLT * *MatrixCk, PLINT nx, PLINT ny )
{
@@ -497,10 +497,10 @@
return NULL;
Xlen = $2 = PyArray_DIMS( tmp )[0];
Ylen = $3 = PyArray_DIMS( tmp )[1];
- size = sizeof ( PLFLT ) * $3;
+ size = $3;
$1 = (PLFLT **) malloc( sizeof ( PLFLT* ) * $2 );
for ( i = 0; i < $2; i++ )
- $1[i] = (PLFLT *) ( PyArray_DATA( tmp ) + i * size );
+ $1[i] = ( (PLFLT *) PyArray_DATA( tmp ) + i * size );
}
%typemap( freearg ) ( const PLFLT * *Matrix, PLINT nx, PLINT ny )
{
@@ -517,10 +517,10 @@
return NULL;
Xlen = PyArray_DIMS( tmp )[0];
Ylen = PyArray_DIMS( tmp )[1];
- size = sizeof ( PLFLT ) * Ylen;
+ size = Ylen;
$1 = (PLFLT **) malloc( sizeof ( PLFLT* ) * Xlen );
for ( i = 0; i < Xlen; i++ )
- $1[i] = (PLFLT *) ( PyArray_DATA( tmp ) + i * size );
+ $1[i] = ( (PLFLT *) PyArray_DATA( tmp ) + i * size );
}
%typemap( freearg ) const PLFLT * *Matrix {
Py_DECREF( tmp$argnum );
@@ -554,10 +554,10 @@
PyErr_SetString( PyExc_ValueError, "Vectors must match matrix." );
return NULL;
}
- size = sizeof ( PLFLT ) * Ylen;
+ size = Ylen;
$1 = (PLFLT **) malloc( sizeof ( PLFLT* ) * Xlen );
for ( i = 0; i < Xlen; i++ )
- $1[i] = (PLFLT *) ( PyArray_DATA( tmp ) + i * size );
+ $1[i] = ( (PLFLT *) PyArray_DATA( tmp ) + i * size );
}
%typemap( freearg ) const PLFLT * *MatrixCk {
Py_DECREF( tmp$argnum );
@@ -577,10 +577,10 @@
PyErr_SetString( PyExc_ValueError, "Vectors must match matrix." );
return NULL;
}
- size = sizeof ( PLFLT ) * Ylen;
+ size = Ylen;
$1 = (PLFLT **) malloc( sizeof ( PLFLT* ) * Xlen );
for ( i = 0; i < Xlen; i++ )
- $1[i] = (PLFLT *) ( PyArray_DATA( tmp ) + i * size );
+ $1[i] = ( (PLFLT *) PyArray_DATA( tmp ) + i * size );
}
%typemap( freearg ) PLFLT * *OutMatrixCk {
Py_DECREF( tmp$argnum );
@@ -607,10 +607,10 @@
array = PyArray_SimpleNew( 2, dims, NPY_FLOAT64 );
if ( !array )
return NULL;
- size = (int) ( sizeof ( double ) * Ylen );
+ size = Ylen;
$3 = (double **) malloc( sizeof ( double * ) * Xlen );
for ( i = 0; i < Xlen; i++ )
- $3[i] = (double *) ( PyArray_DATA( (PyArrayObject *) array ) + i * size );
+ $3[i] = ( (double *) PyArray_DATA( (PyArrayObject *) array ) + i * size );
}
%typemap( freearg ) ( const PLFLT * ArrayY, PLINT ny, PLFLT * *OutMatrixCk )
{
@@ -640,7 +640,7 @@
$1 = (char **) malloc( sizeof ( char* ) * Alen );
for ( i = 0; i < Alen; i++ )
{
- $1[i] = PyArray_DATA( tmp ) + i * PyArray_STRIDES( tmp )[0];
+ $1[i] = (char *) PyArray_DATA( tmp ) + i * PyArray_STRIDES( tmp )[0];
if ( $1[i] == NULL )
{
free( $1 );
@@ -662,7 +662,7 @@
$2 = (char **) malloc( sizeof ( char* ) * Alen );
for ( i = 0; i < Alen; i++ )
{
- $2[i] = PyArray_DATA( tmp ) + i * PyArray_STRIDES( tmp )[0];
+ $2[i] = (char *) PyArray_DATA( tmp ) + i * PyArray_STRIDES( tmp )[0];
if ( $2[i] == NULL )
{
free( $2 );
@@ -808,13 +808,13 @@
return NULL;
}
}
- size = sizeof ( PLFLT ) * tmpGrid2.ny;
+ size = tmpGrid2.ny;
tmpGrid2.xg = (PLFLT **) malloc( sizeof ( PLFLT* ) * tmpGrid2.nx );
for ( i = 0; i < tmpGrid2.nx; i++ )
- tmpGrid2.xg[i] = (PLFLT *) ( PyArray_DATA( pltr_xg ) + i * size );
+ tmpGrid2.xg[i] = ( (PLFLT *) PyArray_DATA( pltr_xg ) + i * size );
tmpGrid2.yg = (PLFLT **) malloc( sizeof ( PLFLT* ) * tmpGrid2.nx );
for ( i = 0; i < tmpGrid2.nx; i++ )
- tmpGrid2.yg[i] = (PLFLT *) ( PyArray_DATA( pltr_yg ) + i * size );
+ tmpGrid2.yg[i] = ( (PLFLT *) PyArray_DATA( pltr_yg ) + i * size );
return &tmpGrid2;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ai...@us...> - 2013-10-20 04:33:17
|
Revision: 12611
http://sourceforge.net/p/plplot/code/12611
Author: airwin
Date: 2013-10-20 04:33:13 +0000 (Sun, 20 Oct 2013)
Log Message:
-----------
Fix bindings/python/plplotcmodule.i so that all -Wuninitialized (with
no optimization) warnings for the C code generated by swig are
removed. The trick was to initialize the appropriate variables to
NULL, and then use Py_CLEAR (which is a no-op if there is a NULL
argument) rather than the old-fashioned and error-prone Py_DECREF and
Py_XDECREF (see http://docs.python.org/2/c-api/refcounting.html) to
adjust the reference count properly in both the normal return path and
in the return path that cleans up after an error.
ToDo. I have since discovered that -O3 -Wuninitialized finds more
uninitialized issues than the -O0 case. I plan to fix those warnings
in a later commit.
Modified Paths:
--------------
trunk/bindings/python/plplotcmodule.i
Modified: trunk/bindings/python/plplotcmodule.i
===================================================================
--- trunk/bindings/python/plplotcmodule.i 2013-10-20 00:47:03 UTC (rev 12610)
+++ trunk/bindings/python/plplotcmodule.i 2013-10-20 04:33:13 UTC (rev 12611)
@@ -138,7 +138,7 @@
#endif
// With preceding count
-%typemap( in ) ( PLINT n, const PLINT * Array ) ( PyArrayObject * tmp )
+%typemap( in ) ( PLINT n, const PLINT * Array ) ( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myIntArray_ContiguousFromObject( $input, NPY_PLINT, 1, 1 );
if ( tmp == NULL )
@@ -148,11 +148,11 @@
}
%typemap( freearg ) ( PLINT n, const PLINT * Array )
{
- Py_DECREF( tmp$argnum );
+ Py_CLEAR( tmp$argnum );
}
// Trailing count and check consistency with previous
-%typemap( in ) ( const PLINT * ArrayCk, PLINT n ) ( PyArrayObject * tmp )
+%typemap( in ) ( const PLINT * ArrayCk, PLINT n ) ( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myIntArray_ContiguousFromObject( $input, NPY_PLINT, 1, 1 );
if ( tmp == NULL )
@@ -167,11 +167,11 @@
}
%typemap( freearg ) ( const PLINT * ArrayCk, PLINT n )
{
- Py_DECREF( tmp$argnum );
+ Py_CLEAR( tmp$argnum );
}
// No count but check consistency with previous
-%typemap( in ) const PLINT * ArrayCk( PyArrayObject * tmp )
+%typemap( in ) const PLINT * ArrayCk( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myIntArray_ContiguousFromObject( $input, NPY_PLINT, 1, 1 );
if ( tmp == NULL )
@@ -183,10 +183,10 @@
}
$1 = (PLINT *) PyArray_DATA( tmp );
}
-%typemap( freearg ) const PLINT * ArrayCk { Py_DECREF( tmp$argnum );}
+%typemap( freearg ) const PLINT * ArrayCk { Py_CLEAR( tmp$argnum );}
// No count but check consistency with previous or NULL
-%typemap( in ) const PLINT * ArrayCkNull( PyArrayObject * tmp )
+%typemap( in ) const PLINT * ArrayCkNull( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myIntArray_ContiguousFromObject( $input, NPY_PLINT, 1, 1 );
if ( tmp == NULL )
@@ -198,10 +198,10 @@
}
$1 = (PLINT *) PyArray_DATA( tmp );
}
-%typemap( freearg ) const PLINT * ArrayCkNull { Py_DECREF( tmp$argnum );}
+%typemap( freearg ) const PLINT * ArrayCkNull { Py_CLEAR( tmp$argnum );}
// Weird case to allow argument to be one shorter than others
-%typemap( in ) const PLINT * ArrayCkMinus1( PyArrayObject * tmp )
+%typemap( in ) const PLINT * ArrayCkMinus1( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myIntArray_ContiguousFromObject( $input, NPY_PLINT, 1, 1 );
if ( tmp == NULL )
@@ -213,9 +213,9 @@
}
$1 = (PLINT *) PyArray_DATA( tmp );
}
-%typemap( freearg ) const PLINT * ArrayCkMinus1 { Py_DECREF( tmp$argnum );}
+%typemap( freearg ) const PLINT * ArrayCkMinus1 { Py_CLEAR( tmp$argnum );}
-%typemap( in ) const PLINT * ArrayCkMinus1Null( PyArrayObject * tmp )
+%typemap( in ) const PLINT * ArrayCkMinus1Null( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myIntArray_ContiguousFromObject( $input, NPY_PLINT, 1, 1 );
if ( tmp == NULL )
@@ -227,10 +227,10 @@
}
$1 = (PLINT *) PyArray_DATA( tmp );
}
-%typemap( freearg ) const PLINT * ArrayCkMinus1Null { Py_DECREF( tmp$argnum );}
+%typemap( freearg ) const PLINT * ArrayCkMinus1Null { Py_CLEAR( tmp$argnum );}
// No length but remember size to check others
-%typemap( in ) const PLINT * Array( PyArrayObject * tmp )
+%typemap( in ) const PLINT * Array( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myIntArray_ContiguousFromObject( $input, NPY_PLINT, 1, 1 );
if ( tmp == NULL )
@@ -238,10 +238,10 @@
Alen = PyArray_DIMS( tmp )[0];
$1 = (PLINT *) PyArray_DATA( tmp );
}
-%typemap( freearg ) const PLINT * Array { Py_DECREF( tmp$argnum );}
+%typemap( freearg ) const PLINT * Array { Py_CLEAR( tmp$argnum );}
// set X and Y length for later consistency checking
-%typemap( in ) const PLINT * ArrayN( PyArrayObject * tmp )
+%typemap( in ) const PLINT * ArrayN( PyArrayObject * tmp = NULL )
{
int i;
tmp = (PyArrayObject *) myIntArray_ContiguousFromObject( $input, NPY_PLINT, 1, 1 );
@@ -259,7 +259,7 @@
if ( $1[i] > Ylen )
Ylen = $1[i];
}
-%typemap( freearg ) const PLINT * ArrayN { Py_DECREF( tmp$argnum );}
+%typemap( freearg ) const PLINT * ArrayN { Py_CLEAR( tmp$argnum );}
//--------------------------------------------------------------------------
// PLFLT Arrays
@@ -293,7 +293,7 @@
#endif
// with preceding count
-%typemap( in ) ( PLINT n, const PLFLT * Array ) ( PyArrayObject * tmp )
+%typemap( in ) ( PLINT n, const PLFLT * Array ) ( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 );
if ( tmp == NULL )
@@ -303,11 +303,11 @@
}
%typemap( freearg ) ( PLINT n, const PLFLT * Array )
{
- Py_DECREF( tmp$argnum );
+ Py_CLEAR( tmp$argnum );
}
// trailing count and check consistency with previous
-%typemap( in ) ( const PLFLT * ArrayCk, PLINT n ) ( PyArrayObject * tmp )
+%typemap( in ) ( const PLFLT * ArrayCk, PLINT n ) ( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 );
if ( tmp == NULL )
@@ -322,11 +322,11 @@
}
%typemap( freearg ) ( const PLFLT * ArrayCk, PLINT n )
{
- Py_DECREF( tmp$argnum );
+ Py_CLEAR( tmp$argnum );
}
// no count, but check consistency with previous
-%typemap( in ) const PLFLT * ArrayCk( PyArrayObject * tmp )
+%typemap( in ) const PLFLT * ArrayCk( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 );
if ( tmp == NULL )
@@ -338,10 +338,10 @@
}
$1 = (PLFLT *) PyArray_DATA( tmp );
}
-%typemap( freearg ) const PLFLT * ArrayCk { Py_DECREF( tmp$argnum );}
+%typemap( freearg ) const PLFLT * ArrayCk { Py_CLEAR( tmp$argnum );}
// no count, but check consistency with previous, or NULL
-%typemap( in ) const PLFLT * ArrayCkNull( PyArrayObject * tmp )
+%typemap( in ) const PLFLT * ArrayCkNull( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 );
if ( tmp == NULL )
@@ -353,10 +353,10 @@
}
$1 = (PLFLT *) PyArray_DATA( tmp );
}
-%typemap( freearg ) const PLFLT * ArrayCkNull { Py_DECREF( tmp$argnum );}
+%typemap( freearg ) const PLFLT * ArrayCkNull { Py_CLEAR( tmp$argnum );}
// check consistency with X dimension of previous
-%typemap( in ) const PLFLT * ArrayCkX( PyArrayObject * tmp )
+%typemap( in ) const PLFLT * ArrayCkX( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 );
if ( tmp == NULL )
@@ -368,10 +368,10 @@
}
$1 = (PLFLT *) PyArray_DATA( tmp );
}
-%typemap( freearg ) const PLFLT * ArrayCkX { Py_DECREF( tmp$argnum );}
+%typemap( freearg ) const PLFLT * ArrayCkX { Py_CLEAR( tmp$argnum );}
// check consistency with Y dimension of previous
-%typemap( in ) const PLFLT * ArrayCkY( PyArrayObject * tmp )
+%typemap( in ) const PLFLT * ArrayCkY( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 );
if ( tmp == NULL )
@@ -383,10 +383,10 @@
}
$1 = (PLFLT *) PyArray_DATA( tmp );
}
-%typemap( freearg ) const PLFLT * ArrayCkY { Py_DECREF( tmp$argnum );}
+%typemap( freearg ) const PLFLT * ArrayCkY { Py_CLEAR( tmp$argnum );}
// set X length for later consistency checking, with trailing count
-%typemap( in ) ( const PLFLT * ArrayX, PLINT nx ) ( PyArrayObject * tmp )
+%typemap( in ) ( const PLFLT * ArrayX, PLINT nx ) ( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 );
if ( tmp == NULL )
@@ -397,11 +397,11 @@
}
%typemap( freearg ) ( const PLFLT * ArrayX, PLINT nx )
{
- Py_DECREF( tmp$argnum );
+ Py_CLEAR( tmp$argnum );
}
// set X length for later consistency checking
-%typemap( in ) const PLFLT * ArrayX( PyArrayObject * tmp )
+%typemap( in ) const PLFLT * ArrayX( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 );
if ( tmp == NULL )
@@ -409,10 +409,10 @@
Xlen = PyArray_DIMS( tmp )[0];
$1 = (PLFLT *) PyArray_DATA( tmp );
}
-%typemap( freearg ) const PLFLT * ArrayX { Py_DECREF( tmp$argnum );}
+%typemap( freearg ) const PLFLT * ArrayX { Py_CLEAR( tmp$argnum );}
// Set Y length for later consistency checking, with trailing count
-%typemap( in ) ( const PLFLT * ArrayY, PLINT ny ) ( PyArrayObject * tmp )
+%typemap( in ) ( const PLFLT * ArrayY, PLINT ny ) ( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 );
if ( tmp == NULL )
@@ -423,11 +423,11 @@
}
%typemap( freearg ) ( const PLFLT * ArrayY, PLINT ny )
{
- Py_DECREF( tmp$argnum );
+ Py_CLEAR( tmp$argnum );
}
// set Y length for later consistency checking
-%typemap( in ) const PLFLT * ArrayY( PyArrayObject * tmp )
+%typemap( in ) const PLFLT * ArrayY( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 );
if ( tmp == NULL )
@@ -435,11 +435,11 @@
Ylen = PyArray_DIMS( tmp )[0];
$1 = (PLFLT *) PyArray_DATA( tmp );
}
-%typemap( freearg ) const PLFLT * ArrayY { Py_DECREF( tmp$argnum );}
+%typemap( freearg ) const PLFLT * ArrayY { Py_CLEAR( tmp$argnum );}
// with trailing count
-%typemap( in ) ( const PLFLT * Array, PLINT n ) ( PyArrayObject * tmp )
+%typemap( in ) ( const PLFLT * Array, PLINT n ) ( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 );
if ( tmp == NULL )
@@ -449,11 +449,11 @@
}
%typemap( freearg ) ( const PLFLT * Array, PLINT n )
{
- Py_DECREF( tmp$argnum );
+ Py_CLEAR( tmp$argnum );
}
// with no count
-%typemap( in ) const PLFLT * Array( PyArrayObject * tmp )
+%typemap( in ) const PLFLT * Array( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 1, 1 );
if ( tmp == NULL )
@@ -461,10 +461,10 @@
Alen = PyArray_DIMS( tmp )[0];
$1 = (PLFLT *) PyArray_DATA( tmp );
}
-%typemap( freearg ) const PLFLT * Array { Py_DECREF( tmp$argnum );}
+%typemap( freearg ) const PLFLT * Array { Py_CLEAR( tmp$argnum );}
// 2D array with trailing dimensions, check consistency with previous
-%typemap( in ) ( const PLFLT * *MatrixCk, PLINT nx, PLINT ny ) ( PyArrayObject * tmp )
+%typemap( in ) ( const PLFLT * *MatrixCk, PLINT nx, PLINT ny ) ( PyArrayObject * tmp = NULL )
{
int i, size;
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 2, 2 );
@@ -484,12 +484,12 @@
}
%typemap( freearg ) ( const PLFLT * *MatrixCk, PLINT nx, PLINT ny )
{
- Py_DECREF( tmp$argnum );
+ Py_CLEAR( tmp$argnum );
free( $1 );
}
// 2D array with trailing dimensions, set the X, Y size for later checking
-%typemap( in ) ( const PLFLT * *Matrix, PLINT nx, PLINT ny ) ( PyArrayObject * tmp )
+%typemap( in ) ( const PLFLT * *Matrix, PLINT nx, PLINT ny ) ( PyArrayObject * tmp = NULL )
{
int i, size;
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 2, 2 );
@@ -504,12 +504,12 @@
}
%typemap( freearg ) ( const PLFLT * *Matrix, PLINT nx, PLINT ny )
{
- Py_DECREF( tmp$argnum );
+ Py_CLEAR( tmp$argnum );
free( $1 );
}
// 2D array with no dimensions, set the X, Y size for later checking
-%typemap( in ) const PLFLT * *Matrix( PyArrayObject * tmp )
+%typemap( in ) const PLFLT * *Matrix( PyArrayObject * tmp = NULL )
{
int i, size;
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 2, 2 );
@@ -523,12 +523,12 @@
$1[i] = ( (PLFLT *) PyArray_DATA( tmp ) + i * size );
}
%typemap( freearg ) const PLFLT * *Matrix {
- Py_DECREF( tmp$argnum );
+ Py_CLEAR( tmp$argnum );
free( $1 );
}
// for plshade1, note the difference in the type for the first arg
-%typemap( in ) ( const PLFLT * Matrix, PLINT nx, PLINT ny ) ( PyArrayObject * tmp )
+%typemap( in ) ( const PLFLT * Matrix, PLINT nx, PLINT ny ) ( PyArrayObject * tmp = NULL )
{
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 2, 2 );
if ( tmp == NULL )
@@ -539,11 +539,11 @@
}
%typemap( freearg ) ( const PLFLT * Matrix, PLINT nx, PLINT ny )
{
- Py_DECREF( tmp$argnum );
+ Py_CLEAR( tmp$argnum );
}
// 2D array, check for consistency
-%typemap( in ) const PLFLT * *MatrixCk( PyArrayObject * tmp )
+%typemap( in ) const PLFLT * *MatrixCk( PyArrayObject * tmp = NULL )
{
int i, size;
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 2, 2 );
@@ -560,13 +560,13 @@
$1[i] = ( (PLFLT *) PyArray_DATA( tmp ) + i * size );
}
%typemap( freearg ) const PLFLT * *MatrixCk {
- Py_DECREF( tmp$argnum );
+ Py_CLEAR( tmp$argnum );
free( $1 );
}
// 2D array, check for consistency and modify in place version (no longer used
// in favor of correct output version in the combined typemap below).
-%typemap( in ) PLFLT * *OutMatrixCk( PyArrayObject * tmp )
+%typemap( in ) PLFLT * *OutMatrixCk( PyArrayObject * tmp = NULL )
{
int i, size;
tmp = (PyArrayObject *) myArray_ContiguousFromObject( $input, NPY_PLFLT, 2, 2 );
@@ -583,14 +583,14 @@
$1[i] = ( (PLFLT *) PyArray_DATA( tmp ) + i * size );
}
%typemap( freearg ) PLFLT * *OutMatrixCk {
- Py_DECREF( tmp$argnum );
+ Py_CLEAR( tmp$argnum );
free( $1 );
}
// Combined typemap useful for specialized case of plgriddata.
// Set Y length for consistency checking, with trailing count
// combined with 2D output array, check for consistency
-%typemap( in ) ( const PLFLT * ArrayY, PLINT ny, PLFLT * *OutMatrixCk ) ( PyArrayObject * tmp, PyObject * array = NULL )
+%typemap( in ) ( const PLFLT * ArrayY, PLINT ny, PLFLT * *OutMatrixCk ) ( PyArrayObject * tmp = NULL, PyObject * array = NULL )
{
int i, size;
npy_intp dims[2];
@@ -614,7 +614,7 @@
}
%typemap( freearg ) ( const PLFLT * ArrayY, PLINT ny, PLFLT * *OutMatrixCk )
{
- Py_DECREF( tmp$argnum );
+ Py_CLEAR( tmp$argnum );
free( $3 );
}
%typemap( argout ) ( const PLFLT * ArrayY, PLINT ny, PLFLT * *OutMatrixCk )
@@ -626,7 +626,7 @@
// special for pllegend / plcolorbar, char ** ArrayCk
//***************************
// no count, but check consistency with previous. Always allow NULL strings.
-%typemap( in ) const char **ArrayCk( PyArrayObject * tmp )
+%typemap( in ) const char **ArrayCk( PyArrayObject * tmp = NULL )
{
int i;
tmp = (PyArrayObject *) PyArray_ContiguousFromObject( $input, NPY_STRING, 1, 1 );
@@ -648,10 +648,10 @@
}
}
}
-%typemap( freearg ) const char **ArrayCk { Py_DECREF( tmp$argnum ); free( $1 );}
+%typemap( freearg ) const char **ArrayCk { Py_CLEAR( tmp$argnum ); free( $1 );}
// With count. Always allow NULL strings.
-%typemap( in ) ( PLINT n, const char **Array ) ( PyArrayObject * tmp )
+%typemap( in ) ( PLINT n, const char **Array ) ( PyArrayObject * tmp = NULL )
{
int i;
tmp = (PyArrayObject *) PyArray_ContiguousFromObject( $input, NPY_STRING, 1, 1 );
@@ -672,7 +672,7 @@
}
%typemap( freearg ) ( PLINT n, const char **Array )
{
- Py_DECREF( tmp$argnum ); free( $2 );
+ Py_CLEAR( tmp$argnum ); free( $2 );
}
//**************************
@@ -762,8 +762,8 @@
void cleanup_PLcGrid1( void )
{
// fprintf(stderr, "cleanup PLcGrid1\n");
- Py_DECREF( pltr_xg );
- Py_DECREF( pltr_yg );
+ Py_CLEAR( pltr_xg );
+ Py_CLEAR( pltr_yg );
}
PLcGrid2* marshal_PLcGrid2( PyObject* input, int isimg )
@@ -823,8 +823,8 @@
// fprintf(stderr, "cleanup PLcGrid2\n");
free( tmpGrid2.xg );
free( tmpGrid2.yg );
- Py_DECREF( pltr_xg );
- Py_DECREF( pltr_yg );
+ Py_CLEAR( pltr_xg );
+ Py_CLEAR( pltr_yg );
}
%}
@@ -953,7 +953,7 @@
// call the python function
result = PyEval_CallObject( python_pltr, arglist );
// release the argument list
- Py_XDECREF( arglist );
+ Py_CLEAR( arglist );
// check and unpack the result
if ( result == NULL )
{
@@ -975,11 +975,11 @@
PLFLT* t = (PLFLT *) PyArray_DATA( tmp );
*tx = t[0];
*ty = t[1];
- Py_XDECREF( tmp );
+ Py_CLEAR( tmp );
}
}
// release the result
- Py_XDECREF( result );
+ Py_CLEAR( result );
// release the global interpreter lock
MY_UNBLOCK_THREADS
}
@@ -1002,7 +1002,7 @@
// call the python function
result = PyEval_CallObject( python_f2eval, arglist );
// release the argument list
- Py_DECREF( arglist );
+ Py_CLEAR( arglist );
// check and unpack the result
if ( !PyFloat_Check( result ) )
{
@@ -1015,7 +1015,7 @@
fresult = (PLFLT) PyFloat_AsDouble( result );
}
// release the result
- Py_XDECREF( result );
+ Py_CLEAR( result );
// release the global interpreter lock
MY_UNBLOCK_THREADS
}
@@ -1047,7 +1047,7 @@
// call the python function
result = PyEval_CallObject( python_label, arglist );
// release the argument list
- //Py_DECREF(arglist);
+ //Py_CLEAR(arglist);
// check and unpack the result
if ( result == NULL )
{
@@ -1066,7 +1066,7 @@
strncpy( string, pystring, len );
}
// release the result
- Py_XDECREF( result );
+ Py_CLEAR( result );
// release the global interpreter lock
MY_UNBLOCK_THREADS
}
@@ -1096,10 +1096,10 @@
// call the python function
result = PyEval_CallObject( python_ct, arglist );
// release the argument list
- Py_DECREF( arglist );
- Py_DECREF( px );
- Py_DECREF( py );
- Py_DECREF( pdata );
+ Py_CLEAR( arglist );
+ Py_CLEAR( px );
+ Py_CLEAR( py );
+ Py_CLEAR( pdata );
// check and unpack the result
if ( result == NULL )
{
@@ -1107,7 +1107,7 @@
PyErr_SetString( PyExc_RuntimeError, "coordinate transform callback must take 5 arguments." );
}
// release the result
- Py_XDECREF( result );
+ Py_CLEAR( result );
// release the global interpreter lock
MY_UNBLOCK_THREADS
}
@@ -1137,9 +1137,9 @@
// call the python function
result = PyEval_CallObject( python_mapform, arglist );
// release the argument list
- Py_DECREF( arglist );
- Py_DECREF( px );
- Py_DECREF( py );
+ Py_CLEAR( arglist );
+ Py_CLEAR( px );
+ Py_CLEAR( py );
// check and unpack the result
if ( result == NULL )
{
@@ -1147,7 +1147,7 @@
PyErr_SetString( PyExc_RuntimeError, "mapform callback must take 3 arguments." );
}
// release the result
- Py_XDECREF( result );
+ Py_CLEAR( result );
// release the global interpreter lock
MY_UNBLOCK_THREADS
}
@@ -1185,7 +1185,7 @@
pltr_type = CB_Python;
Py_XINCREF( input );
}
- Py_DECREF( rep );
+ Py_CLEAR( rep );
}
else
{
@@ -1198,7 +1198,7 @@
void cleanup_pltr( void )
{
- Py_XDECREF( python_pltr );
+ Py_CLEAR( python_pltr );
python_pltr = 0;
}
@@ -1213,7 +1213,7 @@
void cleanup_ct( void )
{
- Py_XDECREF( python_ct );
+ Py_CLEAR( python_ct );
python_ct = 0;
}
@@ -1228,7 +1228,7 @@
void cleanup_mapform( void )
{
- Py_XDECREF( python_mapform );
+ Py_CLEAR( python_mapform );
python_mapform = 0;
}
@@ -1270,7 +1270,7 @@
cleanup_PLcGrid2();
break;
case CB_Python:
- Py_XDECREF( python_pltr );
+ Py_CLEAR( python_pltr );
break;
default:
fprintf( stderr, "pltr_type is invalid\n" );
@@ -1417,7 +1417,7 @@
}
}
%typemap( freearg ) f2eval_func f2eval {
- Py_XDECREF( python_f2eval );
+ Py_CLEAR( python_f2eval );
python_f2eval = 0;
}
// marshall the label function pointer argument
@@ -1425,7 +1425,7 @@
// Release reference to previous function if applicable
if ( python_label )
{
- Py_XDECREF( python_label );
+ Py_CLEAR( python_label );
python_label = 0;
}
// it must be a callable or None
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ai...@us...> - 2013-10-21 01:04:08
|
Revision: 12613
http://sourceforge.net/p/plplot/code/12613
Author: airwin
Date: 2013-10-21 01:04:03 +0000 (Mon, 21 Oct 2013)
Log Message:
-----------
For Python typemap for char *legline[4] get rid of uninitialized
variable for the fail return path.
Modified Paths:
--------------
trunk/bindings/python/plplotcmodule.i
Modified: trunk/bindings/python/plplotcmodule.i
===================================================================
--- trunk/bindings/python/plplotcmodule.i 2013-10-20 04:41:07 UTC (rev 12612)
+++ trunk/bindings/python/plplotcmodule.i 2013-10-21 01:04:03 UTC (rev 12613)
@@ -1456,7 +1456,8 @@
// this typemap takes a sequence of strings and converts them for plstripc
// also checks that previous Arrays were of length 4
//
-%typemap( in ) const char *legline[4] {
+%typemap( in ) const char *legline[4] ( char** tmp = NULL )
+{
int i;
if ( !PySequence_Check( $input ) || PySequence_Size( $input ) != 4 )
{
@@ -1468,19 +1469,21 @@
PyErr_SetString( PyExc_ValueError, "colline and styline args must be length 4." );
return NULL;
}
- $1 = malloc( sizeof ( char* ) * 4 );
+ tmp = (char **) malloc( sizeof ( char* ) * 4 );
+ if ( tmp == NULL ) return NULL;
+ $1 = tmp;
for ( i = 0; i < 4; i++ )
{
$1[i] = PyString_AsString( PySequence_Fast_GET_ITEM( $input, i ) );
if ( $1[i] == NULL )
{
- free( $1 );
+ free( tmp );
return NULL;
}
}
}
%typemap( freearg ) const char *legline[4] {
- free( $1 );
+ free( tmp$argnum );
}
// End of all code associated with special call-back functions.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ai...@us...> - 2013-10-24 17:38:41
|
Revision: 12623
http://sourceforge.net/p/plplot/code/12623
Author: airwin
Date: 2013-10-24 17:38:37 +0000 (Thu, 24 Oct 2013)
Log Message:
-----------
Style previous commit.
Modified Paths:
--------------
trunk/bindings/python/plplotcmodule.i
Modified: trunk/bindings/python/plplotcmodule.i
===================================================================
--- trunk/bindings/python/plplotcmodule.i 2013-10-23 19:27:05 UTC (rev 12622)
+++ trunk/bindings/python/plplotcmodule.i 2013-10-24 17:38:37 UTC (rev 12623)
@@ -1470,7 +1470,8 @@
return NULL;
}
tmp = (char **) malloc( sizeof ( char* ) * 4 );
- if ( tmp == NULL ) return NULL;
+ if ( tmp == NULL )
+ return NULL;
$1 = tmp;
for ( i = 0; i < 4; i++ )
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <and...@us...> - 2013-11-05 15:16:38
|
Revision: 12660
http://sourceforge.net/p/plplot/code/12660
Author: andrewross
Date: 2013-11-05 15:16:33 +0000 (Tue, 05 Nov 2013)
Log Message:
-----------
Fix up uninitialized variable warnings in python bindings. This is a genuine error, although not an uninitialized variable. As set up the mapform func argument could be omitted from plmap / plmeridians, but this is not allowed since subsequent arguments are mandatory. Swig doesn't allow this since not all languages that swig supports can handle this.
Modified Paths:
--------------
trunk/bindings/python/plplotcmodule.i
Modified: trunk/bindings/python/plplotcmodule.i
===================================================================
--- trunk/bindings/python/plplotcmodule.i 2013-11-05 15:04:47 UTC (rev 12659)
+++ trunk/bindings/python/plplotcmodule.i 2013-11-05 15:16:33 UTC (rev 12660)
@@ -1376,12 +1376,13 @@
cleanup_mapform();
}
-// you can omit the mapform func
-%typemap( default ) mapform_func mapform {
- python_mapform = 0;
- $1 = NULL;
-}
+// you cannot omit the mapform func since it appears at the beginning of API calls, before compulsory arguments
+//%typemap( default ) mapform_func mapform {
+// python_mapform = 0;
+// $1 = NULL;
+//}
+
// convert an arbitrary Python object into the void* pointer they want
%typemap( in ) PLPointer PYOBJECT_DATA {
if ( $input == Py_None )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|