Supplying 13 arguments to a Python function taking variable arguments causes a clr.CompileModules failure; 12 arguements compiles fine. The failure message is:
SystemError: Unable to make a reference to a transient module from a non-transient module.
This first sample program works fine with 12 arguments to the variadic function:
Varargs1.py:
def Varargs( arg, *args, **kwargs ):
return "arg: %s\nargs: %s\nkwargs: %s" % ( arg, repr( args ), repr( kwargs ))
print Varargs( 'a', 1,2,3,4,5,6,7,8,9,10,11,12 )
Compiling successfully using pyc.py (which basically just invokes clr.CompileModule:
C:> ipy pyc.py /target:exe /main:Varargs1.py Varargs1.py
Input Files:
Varargs1.py
Output:
Varargs1
Target:
ConsoleApplication
Platform:
ILOnly
Machine:
I386
Compiling...
Saved to Varargs
C:>Varargs1
arg: a
args: (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
kwargs: {}
Adding one more argument (totalling 13) to the Varargs function call causes a clr.CompileModules failure:
Varargs2.py:
def Varargs( arg, *args, **kwargs ):
return "arg: %s\nargs: %s\nkwargs: %s" % ( arg, repr( args ), repr( kwargs ))
print Varargs( 'a', 1,2,3,4,5,6,7,8,9,10,11,12,13 )
C:> ipy pyc.py /target:exe /main:Varargs2.py Varargs2.py
Input Files:
Varargs2.py
Output:
Varargs2
Target:
ConsoleApplication
Platform:
ILOnly
Machine:
I386
Compiling...
Traceback (most recent call last):
File "c:/Program Files (x86)/IronPython 2.7/Tools/Scripts/pyc.py", line 159, in <module>
File "c:/Program Files (x86)/IronPython 2.7/Tools/Scripts/pyc.py", line 151, in Main
SystemError: Unable to make a reference to a transient module from a non-transient module.