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
3e56ff0d
Kaydet (Commit)
3e56ff0d
authored
Eki 05, 2016
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #28370: Speedup asyncio.StreamReader.readexactly
Patch by Коренберг Марк.
üst
5b8d4f97
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
19 deletions
+20
-19
streams.py
Lib/asyncio/streams.py
+17
-19
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/asyncio/streams.py
Dosyayı görüntüle @
3e56ff0d
...
...
@@ -448,6 +448,7 @@ class StreamReader:
assert
not
self
.
_eof
,
'_wait_for_data after EOF'
# Waiting for data while paused will make deadlock, so prevent it.
# This is essential for readexactly(n) for case when n > self._limit.
if
self
.
_paused
:
self
.
_paused
=
False
self
.
_transport
.
resume_reading
()
...
...
@@ -658,25 +659,22 @@ class StreamReader:
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
:
partial
=
b
''
.
join
(
blocks
)
raise
IncompleteReadError
(
partial
,
len
(
partial
)
+
n
)
blocks
.
append
(
block
)
n
-=
len
(
block
)
assert
n
==
0
return
b
''
.
join
(
blocks
)
while
len
(
self
.
_buffer
)
<
n
:
if
self
.
_eof
:
incomplete
=
bytes
(
self
.
_buffer
)
self
.
_buffer
.
clear
()
raise
IncompleteReadError
(
incomplete
,
n
)
yield
from
self
.
_wait_for_data
(
'readexactly'
)
if
len
(
self
.
_buffer
)
==
n
:
data
=
bytes
(
self
.
_buffer
)
self
.
_buffer
.
clear
()
else
:
data
=
bytes
(
self
.
_buffer
[:
n
])
del
self
.
_buffer
[:
n
]
self
.
_maybe_resume_transport
()
return
data
if
compat
.
PY35
:
@coroutine
...
...
Misc/NEWS
Dosyayı görüntüle @
3e56ff0d
...
...
@@ -353,6 +353,9 @@ Library
- Issue #28369: Raise RuntimeError when transport'
s
FD
is
used
with
add_reader
,
add_writer
,
etc
.
-
Issue
#
28370
:
Speedup
asyncio
.
StreamReader
.
readexactly
.
Patch
by
Коренберг
Марк
.
IDLE
----
...
...
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