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

Commita0665e1

Browse files
authored
Fix "ignored exception inhasattr" in dmypy (#19428)
Fixes#19425. That property has no setter so it should safe to exclude.It can raise in inconsistent state that arises when it is not copiedlast?
1 parentabb1cc7 commita0665e1

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

‎mypy/server/astmerge.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,11 @@ def visit_type_alias(self, node: TypeAlias) -> None:
345345
deffixup(self,node:SN)->SN:
346346
ifnodeinself.replacements:
347347
new=self.replacements[node]
348-
skip_slots:tuple[str, ...]= ()
349348
ifisinstance(node,TypeInfo)andisinstance(new,TypeInfo):
350349
# Special case: special_alias is not exposed in symbol tables, but may appear
351350
# in external types (e.g. named tuples), so we need to update it manually.
352-
skip_slots= ("special_alias",)
353351
replace_object_state(new.special_alias,node.special_alias)
354-
replace_object_state(new,node,skip_slots=skip_slots)
352+
replace_object_state(new,node,skip_slots=_get_ignored_slots(new))
355353
returncast(SN,new)
356354
returnnode
357355

@@ -556,9 +554,16 @@ def replace_nodes_in_symbol_table(
556554
ifnode.nodeinreplacements:
557555
new=replacements[node.node]
558556
old=node.node
559-
# Needed for TypeInfo, see comment in fixup() above.
560-
replace_object_state(new,old,skip_slots=("special_alias",))
557+
replace_object_state(new,old,skip_slots=_get_ignored_slots(new))
561558
node.node=new
562559
ifisinstance(node.node, (Var,TypeAlias)):
563560
# Handle them here just in case these aren't exposed through the AST.
564561
node.node.accept(NodeReplaceVisitor(replacements))
562+
563+
564+
def_get_ignored_slots(node:SymbolNode)->tuple[str, ...]:
565+
ifisinstance(node,OverloadedFuncDef):
566+
return ("setter",)
567+
ifisinstance(node,TypeInfo):
568+
return ("special_alias",)
569+
return ()

‎pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,14 @@ addopts = "-nauto --strict-markers --strict-config"
222222
# treat xpasses as test failures so they get converted to regular tests as soon as possible
223223
xfail_strict =true
224224

225+
# Force warnings as errors
226+
filterwarnings = [
227+
"error",
228+
# Some testcases may contain code that emits SyntaxWarnings, and they are not yet
229+
# handled consistently in 3.14 (PEP 765)
230+
"default::SyntaxWarning",
231+
]
232+
225233
[tool.coverage.run]
226234
branch =true
227235
source = ["mypy"]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp