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

stubtest: changes for py313#17261

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
hauntsaninja merged 1 commit intopython:masterfromhauntsaninja:stubtest-313
May 18, 2024
Merged
Changes fromall 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
6 changes: 6 additions & 0 deletionsmypy/stubtest.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -634,6 +634,10 @@ def strip_prefix(s: str, prefix: str) -> str:
if strip_prefix(stub_arg.variable.name, "__") == runtime_arg.name:
return

nonspecific_names = {"object", "args"}

Choose a reason for hiding this comment

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

Why do we need this block?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

stubtest attempts to make sure that positional-only arguments have vaguely the same names. This is because when I first wrote stubtest, I found cases of mismatched pos-only args in typeshed. Now having fixed all of those, the value of this check to typeshed is lower, but I'd still like to keep it.

Python 3.13 added text signatures for more callables, but these signatures are autogenerated, seehttps://github.com/python/cpython/pull/107794/files#diff-1decebeef15f4e0b0ce106c665751ec55068d4d1d1825847925ad4f528b5b872R589

So now we no longer check the stub name is vaguely similar if the runtime name is "object"

JelleZijlstra reacted with thumbs up emoji
if runtime_arg.name in nonspecific_names:
return

def names_approx_match(a: str, b: str) -> bool:
a = a.strip("_")
b = b.strip("_")
Expand DownExpand Up@@ -1455,6 +1459,8 @@ def verify_typealias(
"__getattr__", # resulting behaviour might be typed explicitly
"__setattr__", # defining this on a class can cause worse type checking
"__vectorcalloffset__", # undocumented implementation detail of the vectorcall protocol
"__firstlineno__",
"__static_attributes__",
# isinstance/issubclass hooks that type-checkers don't usually care about
"__instancecheck__",
"__subclasshook__",
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp