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
43605e6b
Unverified
Kaydet (Commit)
43605e6b
authored
Kas 15, 2017
tarafından
Yury Selivanov
Kaydeden (comit)
GitHub
Kas 15, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-32034: Make IncompleteReadError & LimitOverrunError pickleable #4409
üst
4bd41c9b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
streams.py
Lib/asyncio/streams.py
+6
-0
test_streams.py
Lib/test/test_asyncio/test_streams.py
+18
-0
2017-11-15-13-44-28.bpo-32034.uHAOmu.rst
...S.d/next/Library/2017-11-15-13-44-28.bpo-32034.uHAOmu.rst
+1
-0
No files found.
Lib/asyncio/streams.py
Dosyayı görüntüle @
43605e6b
...
...
@@ -35,6 +35,9 @@ class IncompleteReadError(EOFError):
self
.
partial
=
partial
self
.
expected
=
expected
def
__reduce__
(
self
):
return
type
(
self
),
(
self
.
partial
,
self
.
expected
)
class
LimitOverrunError
(
Exception
):
"""Reached the buffer limit while looking for a separator.
...
...
@@ -46,6 +49,9 @@ class LimitOverrunError(Exception):
super
()
.
__init__
(
message
)
self
.
consumed
=
consumed
def
__reduce__
(
self
):
return
type
(
self
),
(
self
.
args
[
0
],
self
.
consumed
)
@coroutine
def
open_connection
(
host
=
None
,
port
=
None
,
*
,
...
...
Lib/test/test_asyncio/test_streams.py
Dosyayı görüntüle @
43605e6b
...
...
@@ -3,6 +3,7 @@
import
gc
import
os
import
queue
import
pickle
import
socket
import
sys
import
threading
...
...
@@ -845,6 +846,23 @@ os.close(fd)
stream
.
_transport
.
__repr__
.
return_value
=
"<Transport>"
self
.
assertEqual
(
"<StreamReader t=<Transport>>"
,
repr
(
stream
))
def
test_IncompleteReadError_pickleable
(
self
):
e
=
asyncio
.
IncompleteReadError
(
b
'abc'
,
10
)
for
proto
in
range
(
pickle
.
HIGHEST_PROTOCOL
+
1
):
with
self
.
subTest
(
pickle_protocol
=
proto
):
e2
=
pickle
.
loads
(
pickle
.
dumps
(
e
,
protocol
=
proto
))
self
.
assertEqual
(
str
(
e
),
str
(
e2
))
self
.
assertEqual
(
e
.
partial
,
e2
.
partial
)
self
.
assertEqual
(
e
.
expected
,
e2
.
expected
)
def
test_LimitOverrunError_pickleable
(
self
):
e
=
asyncio
.
LimitOverrunError
(
'message'
,
10
)
for
proto
in
range
(
pickle
.
HIGHEST_PROTOCOL
+
1
):
with
self
.
subTest
(
pickle_protocol
=
proto
):
e2
=
pickle
.
loads
(
pickle
.
dumps
(
e
,
protocol
=
proto
))
self
.
assertEqual
(
str
(
e
),
str
(
e2
))
self
.
assertEqual
(
e
.
consumed
,
e2
.
consumed
)
if
__name__
==
'__main__'
:
unittest
.
main
()
Misc/NEWS.d/next/Library/2017-11-15-13-44-28.bpo-32034.uHAOmu.rst
0 → 100644
Dosyayı görüntüle @
43605e6b
Make asyncio.IncompleteReadError and LimitOverrunError pickleable.
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