Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Make untyped decorator its own code#19911

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Changes from1 commit
Commits
Show all changes
13 commits
Select commitHold shift + click to select a range
2eae039
Update errorcodes.py: UNTYPED_DECORATOR
wyattscarpenterSep 22, 2025
021fc0a
Update messages.py: UNTYPED_DECORATOR
wyattscarpenterSep 22, 2025
6b0f0d8
black
wyattscarpenterSep 22, 2025
a586b8e
docu
wyattscarpenterSep 23, 2025
3282eb1
enable sub_code_of=MISC for backwards compat reason
wyattscarpenterSep 23, 2025
3456a8b
Apply suggestion from @wyattscarpenter
wyattscarpenterSep 23, 2025
19d9d40
Update error_code_list2.rst
wyattscarpenterSep 23, 2025
8b62963
add tests
wyattscarpenterSep 24, 2025
78af836
Update docs/source/error_code_list2.rst: fix heading underline
wyattscarpenterSep 24, 2025
10ffd2e
fix the fix
wyattscarpenterSep 24, 2025
93ed8dd
make untyped-decorator not a sub cose of misc, per suggestion
wyattscarpenterSep 25, 2025
263b93f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot]Sep 25, 2025
ed20c35
actually this last thing should test sonething different
wyattscarpenterSep 25, 2025
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
PrevPrevious commit
NextNext commit
docu
  • Loading branch information
@wyattscarpenter
wyattscarpenter committedSep 23, 2025
commita586b8ec9510c4dbe3f0ffaf8b5febc750a9a949
23 changes: 23 additions & 0 deletionsdocs/source/error_code_list2.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -676,3 +676,26 @@ Example:
print("red")
case _:
print("other")

.. _code-untyped-decorator:

Error if an untyped decorator makes a typed function effectively untyped [untyped-decorator]
----------------------------------------------------->

If enabled with :option:`--disallow-untyped-decorators`
mypy generates an error if a typed function is wrapped by an untyped decorator
(as this would effectively remove the benefits of typing the function).

Example:

.. code-block:: python

def printing_decorator(func):
def wrapper(*args, **kwds):
print("Calling", func)
return func(*args, **kwds)
return wrapper
# A decorated function.
@printing_decorator # E: Untyped decorator makes function "add_forty_two" untyped [misc]
def add_forty_two(value: int) -> int:
return value + 42

[8]ページ先頭

©2009-2025 Movatter.jp