FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-104050: Argument Clinic: Annotate output_templates() by erlend-aasland · Pull Request #106732 · python/cpython · GitHub

/ cpython Public

gh-104050: Argument Clinic: Annotate output_templates() - #106732

Merged
AlexWaygood merged 3 commits into
python:mainfrom
erlend-aasland:clinic/annotate-output-templates
Jul 14, 2023
Merged

gh-104050: Argument Clinic: Annotate output_templates()#106732
AlexWaygood merged 3 commits into
python:mainfrom
erlend-aasland:clinic/annotate-output-templates

Conversation

erlend-aasland commented Jul 13, 2023
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor

AlexWaygood commented Jul 13, 2023
edited
Loading

Copy link
Copy Markdown
Member

The mypy error might indicate we have the wrong annotation for Parameter.converter

Edit: no, don't think that's the issue actually

Copy link
Copy Markdown
Contributor Author

Thanks for 6891e14! The last error puzzles me, though, and I have no bandwidth for this today; if you find a solution, feel free to land this :)

Copy link
Copy Markdown
Member

The last error puzzles me, though, and I have no bandwidth for this today; if you find a solution, feel free to land this

Yeah, I can't immediately tell what the issue is here. I'm investigating :)

Mypy doesn't have a great understanding of multiple inheritance, so this may be a false positive. But not sure.

Copy link
Copy Markdown
Contributor Author

Aaah, perhaps it is line 801 and 802:

assert isinstance(parameters[0].converter, self_converter)
del parameters[0]

My guess: mypy uses only the information provided in line 801, but is not smart enough to see that line 802 invalidates that assert, so it continues to think parameters[0] is asserted as a self_converter instance.

Copy link
Copy Markdown
Member

Aaah, perhaps it is line 801 and 802:

assert isinstance(parameters[0].converter, self_converter)
del parameters[0]

My guess: mypy uses only the information provided in line 801, but is not smart enough to see that line 802 invalidates that assert, so it continues to think parameters[0] is asserted as a self_converter instance.

Bingo! I'll push a fix.

AlexWaygood commented Jul 14, 2023
edited
Loading

Copy link
Copy Markdown
Member

Does f9cb537 look good to you?

Comment thread Tools/clinic/clinic.py
erlend-aasland marked this pull request as ready for review July 14, 2023 11:44

Copy link
Copy Markdown
Contributor Author

Does f9cb537 look good to you?

Neat!

Copy link
Copy Markdown
Member

Thanks!

AlexWaygood enabled auto-merge (squash) July 14, 2023 11:47
AlexWaygood merged commit 7c95345 into python:main Jul 14, 2023
erlend-aasland deleted the clinic/annotate-output-templates branch July 14, 2023 12:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL