[Matrix-SIG] segmentation fault in Numeric

Yoon, Hoon (CICG - NY Program Trading) HYoon@exchange.ml.com
Mon, 21 Jun 1999 12:29:44 -0400


I think this will do the job. Thanks to Charles.
I found few bugs like that Numpy that crashes it.

**************************************************************
S. Hoon Yoon                   (Quant)                    Merrill Lynch
Equity Trading 
yelled@yahoo.com hoon@bigfoot.com(w)
"Miracle is always only few standard deviations away, but so is
catastrophe."
* Expressed opinions are often my own, but NOT my employer's.
"I feel like a fugitive from the law of averages."    Mauldin
**************************************************************

> -----Original Message-----
> From:	Charles G Waldman 
> Sent:	Wednesday, May 26, 1999 12:53 PM
> To:	David Ascher
> Cc:	matrix-sig@python.org
> Subject:	[Matrix-SIG] Patch for multiarraymodule.c
> 
> 
> The symptom:
> 
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> from Matrix import *
> >>> m = Matrix([1,1],[1,0])
> Segmentation fault (core dumped)
> 
> The cure:
> 
> --- multiarraymodule.c	1999/05/26 16:43:37	1.1
> +++ multiarraymodule.c	1999/05/26 16:50:59
> @@ -864,6 +864,11 @@
>  	if (tpo == Py_None) {
>  		type = PyArray_NOTYPE;
>  	} else {
> +		if (!PyString_Check(tpo)){
> +			PyErr_SetString(PyExc_TypeError, 
> +					"typecode must be a character");
> +			return NULL;
> +		}
>  		tp = PyString_AsString(tpo);
>  		if (tp[0] == 0) type = PyArray_NOTYPE;
>  		else type = tp[0];
> 
> 
> _______________________________________________
> Matrix-SIG maillist  -  Matrix-SIG@python.org
> http://www.python.org/mailman/listinfo/matrix-sig