[MATRIX-SIG] Seg fault in netcdfmodule

Jeffery D. Collins jcollins@pacificnet.net
Thu, 29 Jan 1998 19:27:34 -0800


Konrad Hinsen wrote:

> > I'm having problems with segmentation faults when using
> > netCDFmodule.c and/or ncmodule.c with Python-1.5 under
> > solaris 2.6.  The problem arises when trying to read values
> > from the variables as in:
> >
> > >>> import netcdf
> > >>> fh = netcdf.NetCDFFile('test.nc')
> > >>> v = fh.variables['cosx']
> > >>> v[0]
> > => segmentation fault
>
> There are some problems in the netcdf module that cause crashes
> on machines where malloc(0) returns NULL, but only when accessing
> scalar variables (i.e. no dimensions). That doesn't seem to be
> your case, however.
>
> > I suspect the gcc (2.7.2) compiler.  A recent OS upgrade (2.5.1 to 2.6)
> > required a recompile
> > of gcc, then a recompile of Python-1.5, NumPy (the EZ Hinsen version),
> > and the
>
> If you use my modified NumPy, you must also use a version of the netCDF
> module that was released later. You can recognize newer versions
> by the "import_array" statement in the init function at the end
> of the module. If you use an older version of the module, it will
> crash as soon as it uses any NumPy functions. That could very well
> be the problem you have!

That was the problem.  Also, it looks like when python calls the sliceroutine for
the wildcard case (eg, v[:]), the low and high indexes
are 0 and INT_MAX, respectively.  Is this a change in the interpreter?

Thanks for the help!

Jeff



_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________