[Ironpython-users] Differences with pyc-compiled assemblies?
Nicholas Devenish
misnomer at gmail.com
Mon Nov 12 19:32:05 CET 2012
I've added it at http://ironpython.codeplex.com/workitem/33341
The formatting is screwed up now because I didn't relies it wouldn't preserve any spacing (even returns!). I'm trying to fix it up, but the site seems very slow at the moment - about a minute between any requests to the site.
For now, importing directly seems to work, or I'll play around with removing the call/warning to see if that works - it's only a deprecation.
Many thanks,
Nick
On 12 Nov 2012, at 16:05, Jeff Hardy <jdhardy at gmail.com> wrote:
> On Mon, Nov 12, 2012 at 2:03 AM, Nicholas Devenish <misnomer at gmail.com> wrote:
>> Hi Jeff again,
>>
>>> 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.
>>
>>
>> I spent some time this morning trying to reduce down to a standalone test case; I've got it down to the following, and don't understand what is going wrong so can't work out what else to remove; sorry about the large chain of functions, but it seems to somehow be involved. I hope it is helpful:
>>
>>> from functools import update_wrapper
>>> import inspect
>>>
>>> def decorator(target):
>>> def decorate(fn):
>>> return inspect.getargspec(fn)
>>> return update_wrapper(decorate, target)
>>>
>>> def _decorate_with_warning(func):
>>> @decorator
>>> def warned(fn):
>>> pass
>>> warned(func)
>>>
>>> @_decorate_with_warning
>>> def execute_at(self, event_name, target):
>>> def call_event(target, connection):
>>> if self._somefun(event_name, target, connection):
>>> pass
>>
>> As before, it runs fine as a standalone script
>> $ ipy testipy.py
>>
>> But compiling with:
>>> pyc /out:TestIPy testily.py
>>> ipy
>>>> import clr
>>>> clr.AddReferenceToFileAndPath("TestIPy.dll")
>>>> import testipy
>>
>> Gives the same traceback:
>>> Traceback (most recent call last):
>>> File "runtest.py", line 3, in <module>
>>> File "testipy", line 3, in <module>
>>> File "testipy", line 14, in _decorate_with_warning
>>> File "testipy", line 7, in decorate
>>> File "c:\Program Files\IronPython 2.7\Lib\inspect.py", line 820, in getargspec
>>> File "c:\Program Files\IronPython 2.7\Lib\inspect.py", line 762, in getargs
>>> IndexError: index out of range: 2
>>
>> I hope this is helpful!
>
> Very, thank you. Do you think you could open an issue
> (http://ironpython.codeplex.com/WorkItem/Create) and put the smaller
> repro in it? I'll try to take a look at it soon because I'm working on
> the compiler code anyway, but at least with an issue it won't get
> completely forgotten.
>
> - Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20121112/c4e57ce2/attachment.html>
More information about the Ironpython-users
mailing list