I was experimenting with ihooks module when I started getting crashes with Python for Series 60.

Here's a minimal example that reproduces the crash on my phone. I'm using ihooks.py from Python 2.2.2 source package. I have a dummy import hook like this:

Code:
tsaarni@linux:~/crash-example $ cat myhook.py
import ihooks

class MyImportHook(ihooks.ModuleImporter):
    def import_module(self, name, globals=None, locals=None, fromlist=None):
        return ihooks.ModuleImporter.import_module(self, name, globals, locals, fromlist)

print 'Installed import hook'
MyImportHook().install()
Then I have several modules that import each other. Each of them also import module "somemodule" into their own namespace

Code:
tsaarni@linux:~/crash-example $ cat a.py
import somemodule
import b
tsaarni@linux:~/crash-example $ cat b.py
import somemodule
import c
tsaarni@linux:~/crash-example $ cat c.py
import somemodule
import d
tsaarni@linux:~/crash-example $ cat d.py
import somemodule
import e
tsaarni@linux:~/crash-example $ cat e.py
import somemodule
import f
tsaarni@linux:~/crash-example $ cat f.py
import somemodule
tsaarni@linux:~/crash-example $ cat somemodule.py
pass
I copy the files to phone and run them like this:

Code:
Python 2.2.2 (#0, Dec  2 2004, 18:12:32)
[GCC 2.9-psion-98r2 (Symbian build 540)] on symbian_s60
Type "copyright", "credits" or "license" for more information.
Type "commands" to see the commands available in this simple line editor.
>>> sys.path.append('e:\\python\\test')
>>> import myhook
Installed import hook
>>> import a
Interpreter exits and I get error message

App. closed
Python


It crashes while importing "somemodule" in f.py that is: interpreter crashes while somemodule is imported 6th time. If running the example without installing import hook it works ok!

Anybody seen similar problems?

I'm using N-Gage (the original version).