We actually have the right infrastructure in place to fix this fairly easily in v2.0. In v1.x our old-style instances were rather strange in that they were subclasses of our DynamicType class. Now they're (mostly - other than special cases here and there) just plain old new-style classes in v2.0 which matches CPython's behavior. So now they don't share this code path w/ new-style classes and old-style classes can be patched.
Voting for this bug would be great but I also might just fix it in the v2.0 branch. Thanks for the report Tianyong and Seo for the great repro and initial report. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sanghyeon Seo Sent: Friday, August 10, 2007 8:49 PM To: Discussion of IronPython Subject: Re: [IronPython] TypeError: integer expected occurs when __getitem__ is called 2007/8/11, Tianyong Tang <[EMAIL PROTECTED]>: > I am a newbie with IronPython, and want to test pysnmp eggs of CPython in > IronPython. > > It works in CPython, but when I try it in IronPython, error occurred with > the import of libraries at the beginning: (snip) > > File C:\Python25\lib\site-packages\pyasn1\v1\type\tag.py, > line 84, in tagImplicitly > File C:\Python25\lib\site-packages\pyasn1\v1\type\tag.py, > line 89, in __getitem__ > TypeError: integer expected This is IronPython issue #2728, reported last year. http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=2728 For the IronPython team: here's the relevant lines in the traceback: # A method of TagSet old-style class def tagImplicitly(self, superTag): # some lines omitted return self[:-1] + superTag So the index type is slice(None, -1, None), and the index should be converted by calling __len__ (which IronPython doesn't do). And then __getitem__ tries to index by None and TypeError is raised. -- Seo Sanghyeon _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com