[PYTHON MATRIX-SIG] A bug fix for release 0.20

Perry A. Stoll stoll@atr-sw.atr.co.jp
Tue, 05 Dec 1995 17:23:21 +0900


While Jim Hugunin is gone at the Python conference, I thought I'd
share a bug fix with the list. Finding this bug was accidental (trying
to cast a matrix of ints to types.ListType), but unavoidable (it core
dumped). 

Here is a brief example which demonstrates this:
import Matrix, types
Matrix.mrange(1,5).cast(types.ListType)

The fix is simple once you've found it ;-) It is only one line in the
file Objects/matrixtypes.c. Here are the diffs:

564c566
<       sizeof(PyObject), 'O', PyMatrix_OBJECT};
---
>       sizeof(PyObject *), 'O', PyMatrix_OBJECT};

i.e. the size of entries in an ObjectMatrix should be the size of a
pointer to a PyObject struct, not the size of a PyObject struct. 


And now for more poking around in the guts of the matrix lib...

 -Perry Stoll

  Research Associate, CSRL Advanced Telecommunications Research
  2-2 Hikaridai, Seika-cho Soraku-gun, Kyoto 619-02 JAPAN  
  VOICE: +81-774-95-1217  FINGER: stoll@atrwide.atr.co.jp 
  FAX  : +81-774 95-1208   EMAIL:  stoll@atr-sw.atr.co.jp
PGP 2.6 Key fingerprint = AF 56 5C D8 5F 78 BA FD  21 6E 2A 68 C4 55 9E B0




=================
MATRIX-SIG  - SIG on Matrix Math for Python

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