Skip to content

Commit 5a8b915

Browse files
committed
Import _collections_abc dynamically
1 parent af81301 commit 5a8b915

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/io.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
import _io
5454
import abc
5555

56-
from _collections_abc import _check_methods
5756
from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation,
5857
open, open_code, FileIO, BytesIO, StringIO, BufferedReader,
5958
BufferedWriter, BufferedRWPair, BufferedRandom,
@@ -123,6 +122,7 @@ def read(self, size: int = ..., /) -> T:
123122

124123
@classmethod
125124
def __subclasshook__(cls, C):
125+
from _collections_abc import _check_methods
126126
if cls is Reader:
127127
return _check_methods(C, "read")
128128
return NotImplemented
@@ -142,6 +142,7 @@ def write(self, data: T, /) -> int:
142142

143143
@classmethod
144144
def __subclasshook__(cls, C):
145+
from _collections_abc import _check_methods
145146
if cls is Writer:
146147
return _check_methods(C, "write")
147148
return NotImplemented

0 commit comments

Comments
 (0)