Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-104050: Argument clinic: enable mypy's --warn-return-any setting #107405

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

Merged
merged 4 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions 7 Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4288,10 +4288,11 @@ def eval_ast_expr(
globals: dict[str, Any],
*,
filename: str = '-'
) -> FunctionType:
) -> Any:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a comment as to why Any is the correct annotation here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You weren't going to make finally closing that issue easy, were you? ;)

Let me know if a5103be is too verbose...!

Copy link
Member Author

@AlexWaygood AlexWaygood Jul 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, actually, now that I look at it again, the comment feels like it duplicates the docstring a little bit... not sure if it's worth it? I'll defer to you on whether it's helpful or not!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, you're right. The docstring should be enough!

Copy link
Member Author

@AlexWaygood AlexWaygood Jul 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay -- removed the comment again and tweaked the docstring slightly! How's it look now?

"""
Takes an ast.Expr node. Compiles and evaluates it.
Returns the result of the expression.
Takes an ast.Expr node. Compiles it into a function object,
then calls the function object with 0 arguments.
Returns the result of that function call.

globals represents the globals dict the expression
should see. (There's no equivalent for "locals" here.)
Expand Down
5 changes: 1 addition & 4 deletions 5 Tools/clinic/mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ pretty = True
# make sure clinic can still be run on Python 3.10
python_version = 3.10

# be strict...
# and be strict!
strict = True
strict_concatenate = True
enable_error_code = ignore-without-code,redundant-expr
warn_unreachable = True

# ...except for one extra rule we can't enable just yet
warn_return_any = False
Morty Proxy This is a proxified and sanitized view of the page, visit original site.