Skip to content

Commit 9fc1238

Browse files
committed
gh-127648: Improve Python startup time by ~12%
1 parent ea8ec95 commit 9fc1238

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,
@@ -126,6 +125,7 @@ def read(self, size=..., /):
126125
@classmethod
127126
def __subclasshook__(cls, C):
128127
if cls is Reader:
128+
from _collections_abc import _check_methods
129129
return _check_methods(C, "read")
130130
return NotImplemented
131131

@@ -147,6 +147,7 @@ def write(self, data, /):
147147
@classmethod
148148
def __subclasshook__(cls, C):
149149
if cls is Writer:
150+
from _collections_abc import _check_methods
150151
return _check_methods(C, "write")
151152
return NotImplemented
152153

0 commit comments

Comments
 (0)