On Sun, Nov 11, 2012 at 5:43 PM, Nicholas Devenish <misno...@gmail.com> wrote: >>> Traceback (most recent call last): >>> File "<stdin>", line 1, in <module> >>> File "sqlalchemy\__init__.py", line 52, in <module> >>> File "sqlalchemy\types", line 27, in <module> >>> File "sqlalchemy\schema", line 2670, in <module> >>> File "sqlalchemy\schema", line 2706, in DDLElement >>> File "sqlalchemy\util\deprecations", line 45, in decorate >>> File "sqlalchemy\util\deprecations", line 116, in _decorate_with_warning >>> File "sqlalchemy\util\langhelpers", line 41, in decorate >>> File "c:\Program Files\IronPython 2.7\Lib\inspect.py", line 814, in >>> getargspec >>> File "c:\Program Files\IronPython 2.7\Lib\inspect.py", line 758, in getargs >>> IndexError: index out of range: 2 >> In inspect.py, just before line 758, it looks at co.co_argcount and >> co.co_varnames and assumes that they are the same length, but my guess >> is that they might not be when compiled with pyc. If you can figure >> out exactly what getargspec is being called on, that might help make a >> simpler reproduction that I can work off of. > > So, I've traced down the stack trace with some tested output. This is what it > seems to be doing:
First off, thank you for the detailed analysis. It's very helpful. > >> Starting with the wrapped function (though the line number seems off >> slightly, >> everything else in the stack trace and debug output before the exception >> matches >> up exactly): >> ... snip ... >> That calls getargs: >> >> def getargs(co): >> if not iscode(co): >> raise TypeError('{!r} is not a code object'.format(co)) >> >> nargs = co.co_argcount >> names = co.co_varnames >> args = list(names[:nargs]) >> step = 0 >> >> for i in range(nargs): >> if args[i][:1] in ('', '.'): >> >> With values for the variables: >> >> print "getargs:" >> print " args: {}".format(args) >> print " nargs: {}".format(nargs) >> print " names: {}".format(names) >> >> And the output from these print statements: >> >> getargs: >> args: ['target', 'call_event'] >> nargs: 3 >> names: ('target', 'call_event') > It's odd that nargs (co_argcount) is 3, but names (co_varnames) has only 2 elements. I'm afraid it might be a bug in how IronPython compiles the code. It's possible that no one has tried using pyc on code that accesses the co_* values before. - Jeff _______________________________________________ Ironpython-users mailing list Ironpython-users@python.org http://mail.python.org/mailman/listinfo/ironpython-users