[ python-Bugs-1715581 ] Const(None) in compiler.ast.Return.value

SourceForge.net noreply at sourceforge.net
Wed May 9 11:53:29 CEST 2007


Bugs item #1715581, was opened at 2007-05-09 13:23
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1715581&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Ali Gholami Rudi (aligrudi)
Assigned to: Nobody/Anonymous (nobody)
Summary: Const(None) in compiler.ast.Return.value

Initial Comment:
The problem happens when::

  import compiler

  class Visitor(object):
      def visitReturn(self, node):
          print node.value

  source = """
  def f():
      return
  """
  compiler.walk(compiler.parse(source), Visitor())

I think the value of `node.value` should have been `None` instead of
`Const(None)` as it is for most other nodes when an optional part is
missing.  The same problem (getting `Const(None)` instead of `None`)
exists for `Sliceobj.nodes[i]` and `Discard.expr`.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1715581&group_id=5470


More information about the Python-bugs-list mailing list