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
d9e810a8
Kaydet (Commit)
d9e810a8
authored
Tem 07, 2014
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #12523: asynchat.async_chat.push() now raises a TypeError if it doesn't
get a bytes string
üst
ab826d11
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
asynchat.py
Lib/asynchat.py
+3
-0
test_asynchat.py
Lib/test/test_asynchat.py
+16
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/asynchat.py
Dosyayı görüntüle @
d9e810a8
...
@@ -181,6 +181,9 @@ class async_chat (asyncore.dispatcher):
...
@@ -181,6 +181,9 @@ class async_chat (asyncore.dispatcher):
self
.
close
()
self
.
close
()
def
push
(
self
,
data
):
def
push
(
self
,
data
):
if
not
isinstance
(
data
,
(
bytes
,
bytearray
,
memoryview
)):
raise
TypeError
(
'data argument must be byte-ish (
%
r)'
,
type
(
data
))
sabs
=
self
.
ac_out_buffer_size
sabs
=
self
.
ac_out_buffer_size
if
len
(
data
)
>
sabs
:
if
len
(
data
)
>
sabs
:
for
i
in
range
(
0
,
len
(
data
),
sabs
):
for
i
in
range
(
0
,
len
(
data
),
sabs
):
...
...
Lib/test/test_asynchat.py
Dosyayı görüntüle @
d9e810a8
...
@@ -249,6 +249,22 @@ class TestAsynchat(unittest.TestCase):
...
@@ -249,6 +249,22 @@ class TestAsynchat(unittest.TestCase):
# (which could still result in the client not having received anything)
# (which could still result in the client not having received anything)
self
.
assertGreater
(
len
(
s
.
buffer
),
0
)
self
.
assertGreater
(
len
(
s
.
buffer
),
0
)
def
test_push
(
self
):
# Issue #12523: push() should raise a TypeError if it doesn't get
# a bytes string
s
,
event
=
start_echo_server
()
c
=
echo_client
(
b
'
\n
'
,
s
.
port
)
data
=
b
'bytes
\n
'
c
.
push
(
data
)
c
.
push
(
bytearray
(
data
))
c
.
push
(
memoryview
(
data
))
self
.
assertRaises
(
TypeError
,
c
.
push
,
10
)
self
.
assertRaises
(
TypeError
,
c
.
push
,
'unicode'
)
c
.
push
(
SERVER_QUIT
)
asyncore
.
loop
(
use_poll
=
self
.
usepoll
,
count
=
300
,
timeout
=.
01
)
s
.
join
(
timeout
=
TIMEOUT
)
self
.
assertEqual
(
c
.
contents
,
[
b
'bytes'
,
b
'bytes'
,
b
'bytes'
])
class
TestAsynchat_WithPoll
(
TestAsynchat
):
class
TestAsynchat_WithPoll
(
TestAsynchat
):
usepoll
=
True
usepoll
=
True
...
...
Misc/NEWS
Dosyayı görüntüle @
d9e810a8
...
@@ -27,6 +27,9 @@ Core and Builtins
...
@@ -27,6 +27,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #12523: asynchat.async_chat.push() now raises a TypeError if it doesn't
get a bytes string
- Issue #21707: Add missing kwonlyargcount argument to
- Issue #21707: Add missing kwonlyargcount argument to
ModuleFinder.replace_paths_in_code().
ModuleFinder.replace_paths_in_code().
...
...
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