diff --git a/Lib/io.py b/Lib/io.py index e9fe619392e3d9..fadc19c09be424 100644 --- a/Lib/io.py +++ b/Lib/io.py @@ -53,7 +53,6 @@ import _io import abc -from _collections_abc import _check_methods from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation, open, open_code, FileIO, BytesIO, StringIO, BufferedReader, BufferedWriter, BufferedRWPair, BufferedRandom, @@ -126,6 +125,7 @@ def read(self, size=..., /): @classmethod def __subclasshook__(cls, C): if cls is Reader: + from _collections_abc import _check_methods return _check_methods(C, "read") return NotImplemented @@ -147,6 +147,7 @@ def write(self, data, /): @classmethod def __subclasshook__(cls, C): if cls is Writer: + from _collections_abc import _check_methods return _check_methods(C, "write") return NotImplemented