[IronPython] SystemError while compiling PIL.Image

Dino Viehland dinov at microsoft.com
Fri Oct 23 19:57:44 CEST 2009


This seems to be the simple repro:

X = (42, 43)
class Y:
    def outer_f(self):
        def f((a,b)=X):     
            return a, b
        return f


The fix for this probably won't make it into RC2 and I'm not sure about
2.6.0 either but it'll definitely make it into 2.6.1 at the latest.

Interestingly while this certainly regressed since 2.0 our name binding
here has been subtly broken and other changes just exposed it.  I actually
have another set of changes I've been working on which unbreak it but
it's best to fix the name binding :)

> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-
> bounces at lists.ironpython.com] On Behalf Of William Reade
> Sent: Friday, October 23, 2009 2:41 AM
> To: Discussion of IronPython
> Subject: Re: [IronPython] SystemError while compiling PIL.Image
> 
> Hi Dino
> 
> If I comment out 2 methods, the file parses fine. Uncommenting either is
> enough to cause it to fail.
> 
>      def convert(self, mode=None, data=None, dither=None, palette=WEB,
> colors=256):
> 
>      def rotate(self, angle, resample=NEAREST, expand=0):
> 
> WEB and NEAREST are both set to 0 at module level; convert and rotate
> are both methods on the module-level old-style class Image. The only
> obvious common feature is that both have a non-name default parameter
> following a name default parameter, but I haven't managed to produce a
> minimal repro.
> 
> If you're allowed to just look at other people's code willy-nilly, the
> file is Image.py in PIL 1.16 :).
> 
> Cheers
> william
> 
> 
> 
> 
> Dino Viehland wrote:
> > Is there a parameter with a default value that is a name?  If so what is the
> > scope of the name in relation to the function definition?
> >
> >> -----Original Message-----
> >> From: users-bounces at lists.ironpython.com [mailto:users-
> >> bounces at lists.ironpython.com] On Behalf Of William Reade
> >> Sent: Thursday, October 22, 2009 6:37 AM
> >> To: Discussion of IronPython
> >> Subject: [IronPython] SystemError while compiling PIL.Image
> >>
> >> Transcript follows. The contents of the file don't look obviously
> >> weird.
> >> Does anyone have any idea what the problem might be?
> >>
> >> Cheers
> >> William
> >>
> >> -----------------------------------------------------------------------
> >> --
> >>
> >> C:\dev\ironclad>ipy -X:ExceptionDetail
> >> C:\Python26\Lib\site-packages\PIL\Image.py
> >> Object reference not set to an instance of an object.
> >>     at IronPython.Compiler.Ast.GlobalAllocator.GetVariable(AstGenerator
> >> ag, PythonVariable variable)
> >>     at IronPython.Compiler.Ast.NameExpression.Transform(AstGenerator
> >> ag,
> >> Type type)
> >>     at
> >> IronPython.Compiler.Ast.FunctionDefinition.TransformParameters(AstGener
> >> ator
> >> outer, AstGenerator inner, List`1 defaults, List`1 names, Boolean
> >> needsWrapperMethod, List`1 init)
> >>     at
> >> IronPython.Compiler.Ast.FunctionDefinition.TransformToFunctionExpressio
> >> n(AstGenerator
> >> ag)
> >>     at
> >> IronPython.Compiler.Ast.FunctionDefinition.Transform(AstGenerator ag)
> >>     at
> >> IronPython.Compiler.Ast.AstGenerator.TransformWithLineNumberUpdate(Stat
> >> ement
> >> fromStmt)
> >>     at
> >> IronPython.Compiler.Ast.AstGenerator.TransformMaybeSingleLineSuite(Stat
> >> ement
> >> body, SourceLocation prevStart)
> >>     at IronPython.Compiler.Ast.AstGenerator.Transform(Statement[] from)
> >>     at IronPython.Compiler.Ast.SuiteStatement.Transform(AstGenerator
> >> ag)
> >>     at
> >> IronPython.Compiler.Ast.AstGenerator.TransformWithLineNumberUpdate(Stat
> >> ement
> >> fromStmt)
> >>     at
> >> IronPython.Compiler.Ast.AstGenerator.TransformMaybeSingleLineSuite(Stat
> >> ement
> >> body, SourceLocation prevStart)
> >>     at IronPython.Compiler.Ast.IfStatement.Transform(AstGenerator ag)
> >>     at
> >> IronPython.Compiler.Ast.AstGenerator.TransformWithLineNumberUpdate(Stat
> >> ement
> >> fromStmt)
> >>     at
> >> IronPython.Compiler.Ast.FunctionDefinition.TryTransformBody(AstGenerato
> >> r
> >> ag, List`1 statements)
> >>     at
> >> IronPython.Compiler.Ast.FunctionDefinition.TransformToFunctionExpressio
> >> n(AstGenerator
> >> ag)
> >>     at
> >> IronPython.Compiler.Ast.FunctionDefinition.Transform(AstGenerator ag)
> >>     at
> >> IronPython.Compiler.Ast.AstGenerator.TransformWithLineNumberUpdate(Stat
> >> ement
> >> fromStmt)
> >>     at
> >> IronPython.Compiler.Ast.AstGenerator.TransformMaybeSingleLineSuite(Stat
> >> ement
> >> body, SourceLocation prevStart)
> >>     at IronPython.Compiler.Ast.AstGenerator.Transform(Statement[] from)
> >>     at IronPython.Compiler.Ast.SuiteStatement.Transform(AstGenerator
> >> ag)
> >>     at
> >> IronPython.Compiler.Ast.AstGenerator.TransformWithLineNumberUpdate(Stat
> >> ement
> >> fromStmt)
> >>     at IronPython.Compiler.Ast.ClassDefinition.Transform(AstGenerator
> >> ag)
> >>     at
> >> IronPython.Compiler.Ast.AstGenerator.TransformWithLineNumberUpdate(Stat
> >> ement
> >> fromStmt)
> >>     at
> >> IronPython.Compiler.Ast.AstGenerator.TransformMaybeSingleLineSuite(Stat
> >> ement
> >> body, SourceLocation prevStart)
> >>     at IronPython.Compiler.Ast.AstGenerator.Transform(Statement[] from)
> >>     at IronPython.Compiler.Ast.SuiteStatement.Transform(AstGenerator
> >> ag)
> >>     at
> >> IronPython.Compiler.Ast.AstGenerator.TransformWithLineNumberUpdate(Stat
> >> ement
> >> fromStmt)
> >>     at IronPython.Compiler.Ast.PythonAst.Transform(AstGenerator ag)
> >>     at IronPython.Compiler.Ast.PythonAst.TransformToAst(CompilationMode
> >> mode, CompilerContext context)
> >>     at IronPython.Runtime.PythonContext.CompilePythonCode(Nullable`1
> >> compilationMode, SourceUnit sourceUnit, CompilerOptions options,
> >> ErrorSink errorSink)
> >>     at IronPython.Runtime.PythonContext.GetScriptCode(SourceUnit
> >> sourceCode, String moduleName, ModuleOptions options, Nullable`1 mode)
> >>     at IronPython.Runtime.PythonContext.GetScriptCode(SourceUnit
> >> sourceCode, String moduleName, ModuleOptions options)
> >>     at IronPython.Runtime.PythonContext.CompileModule(String fileName,
> >> String moduleName, SourceUnit sourceCode, ModuleOptions options,
> >> ScriptCode& scriptCode)
> >>     at IronPython.Hosting.PythonCommandLine.RunFileWorker(String
> >> fileName)
> >>     at IronPython.Hosting.PythonCommandLine.RunFile(String fileName)
> >> SystemError: Object reference not set to an instance of an object.
> >>
> >> -----------------------------------------------------------------------
> >> --
> >> _______________________________________________
> >> Users mailing list
> >> Users at lists.ironpython.com
> >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> > _______________________________________________
> > Users mailing list
> > Users at lists.ironpython.com
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >
> 
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list