Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Const(None) in compiler.ast.Return.value #44945

Closed
aligrudi mannequin opened this issue May 9, 2007 · 2 comments
Closed

Const(None) in compiler.ast.Return.value #44945

aligrudi mannequin opened this issue May 9, 2007 · 2 comments
Labels
stdlib Python modules in the Lib dir

Comments

@aligrudi
Copy link
Mannequin

aligrudi mannequin commented May 9, 2007

BPO 1715581

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2007-06-05.17:47:51.000>
created_at = <Date 2007-05-09.09:53:29.000>
labels = ['library']
title = 'Const(None) in compiler.ast.Return.value'
updated_at = <Date 2007-06-05.17:47:51.000>
user = 'https://bugs.python.org/aligrudi'

bugs.python.org fields:

activity = <Date 2007-06-05.17:47:51.000>
actor = 'collinwinter'
assignee = 'collinwinter'
closed = True
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2007-05-09.09:53:29.000>
creator = 'aligrudi'
dependencies = []
files = []
hgrepos = []
issue_num = 1715581
keywords = []
message_count = 2.0
messages = ['31990', '31991']
nosy_count = 2.0
nosy_names = ['collinwinter', 'aligrudi']
pr_nums = []
priority = 'normal'
resolution = 'wont fix'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue1715581'
versions = ['Python 2.5']

@aligrudi
Copy link
Mannequin Author

aligrudi mannequin commented May 9, 2007

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.

@aligrudi aligrudi mannequin closed this as completed May 9, 2007
@aligrudi aligrudi mannequin assigned collinwinter May 9, 2007
@aligrudi aligrudi mannequin added the stdlib Python modules in the Lib dir label May 9, 2007
@aligrudi aligrudi mannequin closed this as completed May 9, 2007
@aligrudi aligrudi mannequin assigned collinwinter May 9, 2007
@aligrudi aligrudi mannequin added the stdlib Python modules in the Lib dir label May 9, 2007
@collinwinter
Copy link
Mannequin

collinwinter mannequin commented Jun 5, 2007

"return" is syntactic shorthand for "return None", so Const(None) is the right value; same thing for Sliceobj. This isn't a bug.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

0 participants