Skip to content

Commit 09f03eb

Browse files
committed
updates KW_ONLY sentinel usage in test stubs
based on python/typeshed#5826
1 parent 7f1ab83 commit 09f03eb

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

mypy/plugins/dataclasses.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def _is_kw_only_type(self, node: Optional[Type]) -> bool:
408408
node_type = get_proper_type(node)
409409
if not isinstance(node_type, Instance):
410410
return False
411-
return node_type.type.fullname == 'dataclasses._KW_ONLY_TYPE'
411+
return node_type.type.fullname == 'dataclasses.KW_ONLY'
412412

413413

414414
def dataclass_class_maker_callback(ctx: ClassDefContext) -> None:

test-data/unit/lib-stub/dataclasses.pyi

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ _T = TypeVar('_T')
55
class InitVar(Generic[_T]):
66
...
77

8-
class _KW_ONLY_TYPE: ...
9-
KW_ONLY = _KW_ONLY_TYPE
8+
class KW_ONLY: ...
109

1110
@overload
1211
def dataclass(_cls: Type[_T]) -> Type[_T]: ...

0 commit comments

Comments
 (0)