This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author iritkatriel
Recipients iritkatriel, noureddine.hamid, taleinat, yselivanov
Date 2020-12-03.15:12:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1607008326.05.0.988807661285.issue42116@roundup.psfhosted.org>
In-reply-to
Content
1. For a comment line, the tokenizer emits a COMMENT token followed by an NL token for the newline. The inspect.BlockFinder.tokeneater increments its "last" field to the last line it identified as belonging to the code block. Currently it increments it when it sees a NEWLINE token, but not for an NL token.

2. For a comment line, the tokenizer does not emit an INDENT/DEDENT token, so the indentation level when it is processes is assumed to be equal to that of the previous line.

PR 23630 aims to include comment lines in the block if their start column is after the start column of the opening line of the block:

   def f():
      return 42

     # this is a part of f
   # this is not a part of f
History
Date User Action Args
2020-12-03 15:12:06iritkatrielsetrecipients: + iritkatriel, taleinat, yselivanov, noureddine.hamid
2020-12-03 15:12:06iritkatrielsetmessageid: <1607008326.05.0.988807661285.issue42116@roundup.psfhosted.org>
2020-12-03 15:12:06iritkatriellinkissue42116 messages
2020-12-03 15:12:05iritkatrielcreate