Visitar URL original
bpo-44446: support lineno being None in traceback.FrameSummary by FFY00 · Pull Request #26781 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20220203014526/https://github.com/python/cpython/pull/26781
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

bpo-44446: support lineno being None in traceback.FrameSummary #26781

Merged
merged 1 commit into from Jul 8, 2021

Conversation

@FFY00
Copy link
Member

@FFY00 FFY00 commented Jun 17, 2021 •

As of 088a15c, lineno is None instead of -1 if there is no line number.

Signed-off-by: Filipe Laíns lains@riseup.net

https://bugs.python.org/issue44446

@FFY00 FFY00 requested a review from iritkatriel Jun 17, 2021
@FFY00 FFY00 force-pushed the bpo-44446 branch 2 times, most recently from 70c0a93 to b8963bf Jun 17, 2021
@graingert
Copy link
Contributor

@graingert graingert commented Jun 17, 2021

Might be worth including a regression test formatting a Traceback containing [v async for v in vs()]?

@FFY00
Copy link
Member Author

@FFY00 FFY00 commented Jun 17, 2021

Maybe, though I do not know where such test should belong. I'd hope that is already being tested 😁

Copy link
Member

@iritkatriel iritkatriel left a comment

Might be worth including a regression test formatting a Traceback containing [v async for v in vs()]?

Yes, might be nice to have also a small test for StackSummary.format() with a None in one of the FrameSummary's.

@iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Jun 17, 2021

Maybe, though I do not know where such test should belong. I'd hope that is already being tested 😁

It would belong here, in TracebackException's tests. If it was already tested we wouldn't be here!

@graingert
Copy link
Contributor

@graingert graingert commented Jun 17, 2021

Why does the [v async for v in vs()] frame not have a lineno? Is that also a bug?

@iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Jun 17, 2021

Why does the [v async for v in vs()] frame not have a lineno? Is that also a bug?

No idea. Probably worth asking in a separate bpo.

@FFY00
Copy link
Member Author

@FFY00 FFY00 commented Jun 18, 2021

See my comment on bpo. That test will have to wait for #26782. Do you want to wait or should it be done in a separate PR?

@iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Jun 18, 2021

See my comment on bpo. That test will have to wait for #26782. Do you want to wait or should it be done in a separate PR?

Why does the test depend on that? Traceback shouldn’t blow up with -1 or None.

@graingert
Copy link
Contributor

@graingert graingert commented Jun 18, 2021

See my comment on bpo. That test will have to wait for #26782. Do you want to wait or should it be done in a separate PR?

Why does the test depend on that? Traceback shouldn’t blow up with -1 or None.

Right but I'm assuming @FFY00 wants to assert on the correct output rather than just it not raising

@iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Jun 18, 2021

Right but I'm assuming @FFY00 wants to assert on the correct output rather than just it not raising

I assumed it was None in both cases, because linecache won't find anything for line -1 (but I didn't check).

@FFY00
Copy link
Member Author

@FFY00 FFY00 commented Jun 20, 2021

I mean, I can just add a check making sure it doesn't raise. Maybe it makes sense given that the other PR might take a while, and this PR might be enough to remove the release blocker status. @pablogsal what do you think?

@pablogsal
Copy link
Member

@pablogsal pablogsal commented Jun 20, 2021

I mean, I can just add a check making sure it doesn't raise. Maybe it makes sense given that the other PR might take a while, and this PR might be enough to remove the release blocker status. @pablogsal what do you think?

The release blocker is for both, including the regression in a previously valid line number. Also, my gut feeling is that there is also a ownership issue with the locals after some of the latest changes in the frames and the error reporting, but I need time to investigate. Hopefully @markshannon can take a look before.

@FFY00
Copy link
Member Author

@FFY00 FFY00 commented Jun 20, 2021 •

I have some time, if this is something you think I could help with. I just need some pointers 😅

@pablogsal
Copy link
Member

@pablogsal pablogsal commented Jun 20, 2021

I have some time, if this is something you think I could help with. I just need some pointers 😅

Unfortunately I have no more pointers than the regression information and my gut feeling on some underlying problem. I would try to create a situation where the locals are accessed when getting the line number of the generator to prove this.

@FFY00
Copy link
Member Author

@FFY00 FFY00 commented Jun 20, 2021

Okay. Did you see my other PR (#26782)? Perhaps you could comment there if you have anything to add.

@pablogsal
Copy link
Member

@pablogsal pablogsal commented Jun 20, 2021

Okay. Did you see my other PR (#26782)? Perhaps you could comment there if you have anything to add.

Haha, I did not see your other PR, but that confirms my theory: there is a ownership issue with the locals. I did not debug it but I bet that if you check what's wrong you are accessing a locals dict with 0 refcount.

@pablogsal
Copy link
Member

@pablogsal pablogsal commented Jun 20, 2021

Haha, I did not see your other PR, but that confirms my theory: there is a ownership issue with the locals. I did not debug it but I bet that if you check what's wrong you are accessing a locals dict with 0 refcount.

I checked, and indeed my gut feeling is correct:

#26782 (comment)

As of 088a15c, lineno is None instead
of -1 if there is no line number.

Signed-off-by: Filipe Laíns <lains@riseup.net>
@FFY00
Copy link
Member Author

@FFY00 FFY00 commented Jul 8, 2021

Sorry, I don't have much time today so I just rushed to rebase this to unblock the new release. I can open a new PR for the test discussed here later when I am able to get back, I think that'd also make sense from an organizational standpoint given the test is not logically related to this change, but rather the underlying issue, which got fixed separatedly.

@pablogsal pablogsal merged commit 91a8f8c into python:main Jul 8, 2021
13 checks passed
@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jul 8, 2021

Thanks @FFY00 for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jul 8, 2021

Sorry @FFY00 and @pablogsal, I had trouble checking out the 3.10 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 91a8f8c16ca9a7e2466a8241d9b41769ef97d094 3.10

@pablogsal
Copy link
Member

@pablogsal pablogsal commented Jul 8, 2021

Thanks @FFY00 for your contribution!

pablogsal added a commit to pablogsal/cpython that referenced this issue Jul 8, 2021
…pythonGH-26781)

As of 088a15c, lineno is None instead
of -1 if there is no line number.

Signed-off-by: Filipe Laíns <lains@riseup.net>.
(cherry picked from commit 91a8f8c)

Co-authored-by: Filipe Laíns <lains@riseup.net>
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Jul 8, 2021

GH-27072 is a backport of this pull request to the 3.10 branch.

pablogsal pushed a commit that referenced this issue Jul 8, 2021
…GH-26781) (GH-27072)

As of 088a15c, lineno is None instead
of -1 if there is no line number.

Signed-off-by: Filipe Laíns <lains@riseup.net>.
(cherry picked from commit 91a8f8c)

Co-authored-by: Filipe Laíns <lains@riseup.net>

Co-authored-by: Filipe Laíns <lains@riseup.net>
JuniorJPDJ added a commit to JuniorJPDJ/cpython that referenced this issue Aug 12, 2021
…nGH-26781)

As of 088a15c, lineno is None instead
of -1 if there is no line number.

Signed-off-by: Filipe Laíns <lains@riseup.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants