Skip to content

Commit 8f5cfe4

Browse files
committed
Apply review changes for _pyio _blkszie
1 parent 3122665 commit 8f5cfe4

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Lib/_pyio.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,11 +1614,14 @@ def __repr__(self):
16141614

16151615
@property
16161616
def _blksize(self):
1617-
if self._stat_atopen:
1618-
res = getattr(self._stat_atopen, "st_blksize", 0)
1619-
1620-
# WASI sets blksize to 0
1621-
return res if res > 0 else DEFAULT_BUFFER_SIZE
1617+
if self._stat_atopen is None:
1618+
return DEFAULT_BUFFER_SIZE
1619+
1620+
blksize = getattr(self._stat_atopen, "st_blksize", 0)
1621+
# WASI sets blsize to 0
1622+
if not blksize:
1623+
return DEFAULT_BUFFER_SIZE
1624+
return blksize
16221625

16231626
def _checkReadable(self):
16241627
if not self._readable:

0 commit comments

Comments
 (0)