Created
December 9, 2014 18:05
-
-
Save ironpythonbot/3b39a1d040193dafc2de to your computer and use it in GitHub Desktop.
CodePlex Issue #33341 Plain Text Attachments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I've found a problem that only seems to happen when importing from a pyc compiled assembly, but does not show when importing the script directly. Attached is as far as I have managed to reduce a simple test case to (I first came across this in SQLAlchemy). | |
Running directly (or, opening the repl and then importing manually): | |
$ ipy testipy.py | |
Works fine, but compiling with pyc (assuming you have an alias): | |
$ pyc /out:TestIPy testily.py | |
And then running the script: | |
import clr | |
clr.AddReferenceToFileAndPath("TestIPy.dll") | |
import testipy | |
Gives the following 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment