Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
3845521b
Kaydet (Commit)
3845521b
authored
Ock 07, 2014
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
asyncio: Fix deadlock in readexactly(). Fixes issue #20154.
üst
a101bdb8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
10 deletions
+21
-10
streams.py
Lib/asyncio/streams.py
+19
-10
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/asyncio/streams.py
Dosyayı görüntüle @
3845521b
...
...
@@ -220,6 +220,7 @@ class StreamReader:
if
loop
is
None
:
loop
=
events
.
get_event_loop
()
self
.
_loop
=
loop
# TODO: Use a bytearray for a buffer, like the transport.
self
.
_buffer
=
collections
.
deque
()
# Deque of bytes objects.
self
.
_byte_count
=
0
# Bytes in buffer.
self
.
_eof
=
False
# Whether we're done.
...
...
@@ -384,15 +385,23 @@ class StreamReader:
if
self
.
_exception
is
not
None
:
raise
self
.
_exception
if
n
<=
0
:
return
b
''
# There used to be "optimized" code here. It created its own
# Future and waited until self._buffer had at least the n
# bytes, then called read(n). Unfortunately, this could pause
# the transport if the argument was larger than the pause
# limit (which is twice self._limit). So now we just read()
# into a local buffer.
blocks
=
[]
while
n
>
0
:
block
=
yield
from
self
.
read
(
n
)
if
not
block
:
break
blocks
.
append
(
block
)
n
-=
len
(
block
)
while
self
.
_byte_count
<
n
and
not
self
.
_eof
:
assert
not
self
.
_waiter
self
.
_waiter
=
futures
.
Future
(
loop
=
self
.
_loop
)
try
:
yield
from
self
.
_waiter
finally
:
self
.
_waiter
=
None
# TODO: Raise EOFError if we break before n == 0? (That would
# be a change in specification, but I've always had to add an
# explicit size check to the caller.)
return
(
yield
from
self
.
read
(
n
)
)
return
b
''
.
join
(
blocks
)
Misc/NEWS
Dosyayı görüntüle @
3845521b
...
...
@@ -75,6 +75,8 @@ Core and Builtins
Library
-------
- Issue #20154: Deadlock in asyncio.StreamReader.readexactly().
- Issue #16113: Remove sha3 module again.
- Issue #20111: pathlib.Path.with_suffix() now sanity checks the given suffix.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment