SWIG extension crashes

Andrew Gregory andrew.gregory at npl.co.uk
Thu Mar 6 19:09:34 CET 2003

Using this minimal extension,

class MyClass

  MyClass() { };  // Constructor
  ~MyClass() { }; // destructor               
  PyObject* Mysend();


PyObject* MyClass::Mysend()
    return Py_None;

Wrapped with SWIG 1.3.17 using -c++ and -shadow options to produce
files mymodule.py and _mymodule.pyd. If in Python I type:

import mymodule
for i in range(10000):

I get a crash (abnormal termination). For only 1000 loops it's ok. I
use Windows and Python 2.2.2.

SWIG interface file is
%module mymodule
   #include "mymodule.h"
%include mymodule.h

Does any have any ideas or know a work-around?


More information about the Python-list mailing list