Issue1415

classification
Title: ast Node creation fails with no arg constructors
Type: behaviour Severity: normal
Components: Core Versions: 2.5.0
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: fwierzbicki, kellrott
Priority: Keywords:

Created on 2009-07-28.23:11:16 by kellrott, last changed 2009-08-04.23:57:43 by fwierzbicki.

Files
File name Uploaded Description Edit Remove
bug.py fwierzbicki, 2009-08-03.17:57:17 .py file that reproduces this bug
Messages
msg4958 (view) Author: Kyle (kellrott) Date: 2009-07-28.23:11:16
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)
msg4987 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2009-08-04.23:57:42
Fixed as of r6632
History
Date User Action Args
2009-08-04 23:57:43fwierzbickisetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg4987
2009-08-04 23:55:08fwierzbickisettitle: ast Node creation -> ast Node creation fails with no arg constructors
2009-08-03 17:57:17fwierzbickisetfiles: + bug.py
resolution: accepted
2009-08-03 17:49:41fwierzbickisetassignee: fwierzbicki
nosy: + fwierzbicki
2009-07-28 23:11:16kellrottcreate