@@ -677,10 +677,13 @@ def __getitem__(self, params):
677677_PROTO_ALLOWLIST = {
678678 'collections.abc' : [
679679 'Callable' , 'Awaitable' , 'Iterable' , 'Iterator' , 'AsyncIterable' ,
680- 'Hashable' , 'Sized' , 'Container' , 'Collection' , 'Reversible' , 'Buffer' ,
680+ 'AsyncIterator' , 'Hashable' , 'Sized' , 'Container' , 'Collection' ,
681+ 'Reversible' , 'Buffer' ,
681682 ],
682683 'contextlib' : ['AbstractContextManager' , 'AbstractAsyncContextManager' ],
684+ 'io' : ['Reader' , 'Writer' ],
683685 'typing_extensions' : ['Buffer' ],
686+ 'os' : ['PathLike' ],
684687}
685688
686689
@@ -704,8 +707,10 @@ def _get_protocol_attrs(cls):
704707
705708# `__match_args__` attribute was removed from protocol members in 3.13,
706709# we want to backport this change to older Python versions.
707- # Breakpoint: https://github.com/python/cpython/pull/110683
708- if sys .version_info >= (3 , 13 ):
710+ # 3.14 additionally added `io.Reader`, `io.Writer` and `os.PathLike` to
711+ # the list of allowed protocol allowlist.
712+ # https://github.com/python/cpython/issues/127647
713+ if sys .version_info >= (3 , 14 ):
709714 Protocol = typing .Protocol
710715else :
711716 def _allow_reckless_class_checks (depth = 2 ):
0 commit comments