| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Bump. Hopefully this doesn't get too stale from all of the new sprint PRs! |
Sorry, something went wrong.
|
Alas, it's already stale. Could you merge the conflicts? |
Sorry, something went wrong.
|
@gvanrossum Merged, tests are passing. |
Sorry, something went wrong.
There was a problem hiding this comment.
This is getting close, but I have a couple of questions, since this looks like it will be fairly invasive...
Sorry, something went wrong.
| # the opposite end of the range to search for "# type: ignore" | ||
| # comments in. This reports the correct line in the event of an | ||
| # error, but keeps old pre-3.8 "# type: ignore" comments working | ||
| # correctly. |
There was a problem hiding this comment.
This comment confused me. The key thing to note here is that we want to point lineno to the line that has the def keyword, while we want to point end_lineno to the line that would have been used for Python 3.7 and before. And we must compute end_lineno (i.e. the "old start line") using the crufty way given here since the old way of computing it (i.e. n.lineno + len(n.decorator_list) won't have the same result in 3.8.
Sorry that this is still so confusing. The code is right!
Sorry, something went wrong.
There was a problem hiding this comment.
Are you going to update these comments? I hope so!
Sorry, something went wrong.
There was a problem hiding this comment.
I'll try to reword this to be more concise. Maybe something like:
# Set end_lineno to the old pre-3.8 lineno, in order to keep
# existing "# type: ignore" comments working:
Sorry, something went wrong.
There was a problem hiding this comment.
Sounds good -- also for the other location!
Sorry, something went wrong.
| # comments in. This reports the correct line in the event of an | ||
| # error, but keeps old pre-3.8 "# type: ignore" comments working | ||
| # correctly. | ||
| lineno = n.lineno |
There was a problem hiding this comment.
Do you even need this? It seems this was already set on line 432 above.
Sorry, something went wrong.
There was a problem hiding this comment.
Nice catch. I believe that's left over from an earlier iteration of this change.
Sorry, something went wrong.
| # lineno is where the error is reported, and end_lineno defines the | ||
| # opposite end of the range to search for "# type: ignore" comments in. | ||
| # This reports the correct line in the event of an error, but keeps old | ||
| # pre-3.8 "# type: ignore" comments working correctly. |
There was a problem hiding this comment.
Similar comment (except I wasn't really confused here, since I had just figured out the previous one :-).
Sorry, something went wrong.
There was a problem hiding this comment.
As above:
# Set end_lineno to the old mypy 0.700 lineno, in order to keep
# existing "# type: ignore" comments working:
Sorry, something went wrong.
|
New changes are passing, ready for another review. |
Sorry, something went wrong.
|
Thanks! Congratulations on getting this thorny PR in. Excellent work. |
Sorry, something went wrong.
|
Thanks, that really means a lot coming from you. Always happy to help! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #3871. This change fixes a few things concerning class/function definition line numbers.
For users running mypy with Python 3.8+:
For other users:
About 15 tests had to have their error messages / nodes moved down one line, and 4 new regression tests have been added to check-38.test.