classification
Title: How to add end_lineno in pyclbr?
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.10
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: BTaskaya, cheryl.sabella, gvanrossum, kebab-mai-haddi
Priority: normal Keywords:

Created on 2021-01-13 07:18 by kebab-mai-haddi, last changed 2021-01-25 19:57 by kebab-mai-haddi. This issue is now closed.

Messages (4)
msg385002 - (view) Author: Aviral Srivastava (kebab-mai-haddi) Date: 2021-01-13 07:18
I created a PR a year ago, https://github.com/python/cpython/pull/16466/files, and now the source code is completely changed. How do I create another PR or if there is another way through which I can get an end line for each object (class and function) as stated here(https://stackoverflow.com/questions/58142456/how-to-get-the-scope-of-a-class-in-terms-of-starting-line-and-end-line-in-python).
msg385074 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2021-01-14 19:09
Hopefully Batuhan (who changed this code ~2 months ago) or Cheryl (who reviewed your previous patch) can help you. You can just close your existing PR and create a new one, still linking to your original issue 38307.
msg385075 - (view) Author: Batuhan Taskaya (BTaskaya) * (Python committer) Date: 2021-01-14 19:12
It is actually much easier now, considering that we are operating on the AST instead of the token stream. You probably only have to add a new field to Function/Class classes for end_lineno and access .end_lineno attribute here just like how we do for .lineno 
https://github.com/python/cpython/blob/971235827754eee6c0d9f7d39b52fecdfd4cb7b4/Lib/pyclbr.py#L212-L214
msg385656 - (view) Author: Aviral Srivastava (kebab-mai-haddi) Date: 2021-01-25 19:57
But how do I generate the endline no? Initially, I could
do, stack[-1][0].end_lineno = start[0] - 1 but how do I this now?

Best,
Aviral Srivastava
LinkedIn
<https://mailtrack.io/trace/link/c4502b41561cd995471aa8291b55e07212663a68?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fsriavi%2F&userId=762683&signature=7970b62394c71d67>
| Website
<https://mailtrack.io/trace/link/91745120231e6a5490b7cad9769cf43b37257fe4?url=https%3A%2F%2Faviralsrivastava.com%2F&userId=762683&signature=b0d6da90458944b7>

On Thu, Jan 14, 2021 at 11:12 AM Batuhan Taskaya <report@bugs.python.org>
wrote:

>
> Batuhan Taskaya <isidentical@gmail.com> added the comment:
>
> It is actually much easier now, considering that we are operating on the
> AST instead of the token stream. You probably only have to add a new field
> to Function/Class classes for end_lineno and access .end_lineno attribute
> here just like how we do for .lineno
>
> https://github.com/python/cpython/blob/971235827754eee6c0d9f7d39b52fecdfd4cb7b4/Lib/pyclbr.py#L212-L214
> <https://mailtrack.io/trace/link/fcde5f4006527669633139919288094eb35d4671?url=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fblob%2F971235827754eee6c0d9f7d39b52fecdfd4cb7b4%2FLib%2Fpyclbr.py%23L212-L214&userId=762683&signature=3181a7c4de5a239b>
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue42920
> <https://mailtrack.io/trace/link/a14e8d641bc2744efb70ac68058359d310914537?url=https%3A%2F%2Fbugs.python.org%2Fissue42920&userId=762683&signature=ef176fb5cb5491fd>
> >
> _______________________________________
>
History
Date User Action Args
2021-01-25 19:57:14kebab-mai-haddisetmessages: + msg385656
2021-01-14 19:12:27BTaskayasetmessages: + msg385075
2021-01-14 19:09:29gvanrossumsetstatus: open -> closed

nosy: + gvanrossum, cheryl.sabella, BTaskaya
messages: + msg385074

resolution: duplicate
stage: resolved
2021-01-13 07:18:44kebab-mai-haddicreate