Message4958

Author kellrott
Recipients kellrott
Date 2009-07-28.23:11:16
SpamBayes Score 1.0291324e-07
Marked as misclassified No
Message-id <1248822676.8.0.409794783989.issue1415@psf.upfronthosting.co.za>
In-reply-to
Content
AST node creation does not work in Jython in the same way as it does in
CPython.

Example:

try:
    #it's ast in Python 2.6
    import ast
except ImportError:
    #it's _ast in Python 2.5
    import _ast
    old_ast = 1

def astnode_genAssign( targets, value):
    if ( old_ast ):
        tmp = _ast.Assign()
        tmp.targets = targets
        tmp.value = value
        tmp.lineno = 0
        return tmp
    else:
        tmp = ast.Assign( )
        tmp.targets = targets
        tmp.value = value
        tmp.lineno = 0
        return tmp


A call to astnode_genAssign works in Python2.5 and Python2.6, but in
Jython 2.5 it produces:

 tmp = ast.Assign( )
TypeError: Assign() takes 2-4 arguments (0 given)
History
Date User Action Args
2009-07-28 23:11:16kellrottsetrecipients: + kellrott
2009-07-28 23:11:16kellrottsetmessageid: <1248822676.8.0.409794783989.issue1415@psf.upfronthosting.co.za>
2009-07-28 23:11:16kellrottlinkissue1415 messages
2009-07-28 23:11:16kellrottcreate