[IronPython] new.classobj() fails with "TypeError: __bases__ items must be classes (got type)"
abs
soroker at gmail.com
Wed Nov 7 22:32:41 CET 2007
Hello,
Here are two files, A.py and B.py:
(Execution details follow)
--- file A.py ---
1
2 import sys
3 import new
4 import imp
5
6 def main():
7 moduleInfo = imp.find_module('B')
8 module = imp.load_module('B', moduleInfo[0], moduleInfo[1],
moduleInfo[2])
9
10 t = new.classobj('Test1', (getattr(module, 'Test'),), {})
11 i = t()
12 i.Execute()
13
14 if __name__ == '__main__':
15 sys.exit(main())
16
--- /file A.py ---
--- file B.py ---
1
2 class Test(object):
3 def __init__(self):
4 print 'hello'
5
6 def Execute(self):
7 print 'hello'
8
--- /file B.py ---
$ c:\Python25\python.exe A.py
hello
hello
$ "c:\Program Files\IronPython-1.1\ipy.exe" A.py
Traceback (most recent call last):
File C:\A.py, line 23, in Initialize
File C:\A.py, line 18, in main
TypeError: Unable to cast object of type
'IronPython.Runtime.Types.UserType' to type
'IronPython.Runtime.Types.OldClass'.
$ "c:\Program Files\IronPython-2.0A5\ipy.exe" A.py
Traceback (most recent call last):
File A.py, line 23, in Initialize
File , line 0, in _stub_##19
File A.py, line 16, in main
File , line 0, in _stub_##51
TypeError: __bases__ items must be classes (got type)
Am I doing something wrong, or is this a bug?
Thanks!
More information about the Ironpython-users
mailing list