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
9f2f8333
Kaydet (Commit)
9f2f8333
authored
Tem 07, 2008
tarafından
Josiah Carlson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed bugs 760475, 953599, and 1519. This is a translation of changelist 64768
to the py3k branch.
üst
35bf9bf6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
asynchat.py
Lib/asynchat.py
+2
-2
asyncore.py
Lib/asyncore.py
+4
-2
test_asyncore.py
Lib/test/test_asyncore.py
+8
-2
No files found.
Lib/asynchat.py
Dosyayı görüntüle @
9f2f8333
...
...
@@ -77,7 +77,7 @@ class async_chat (asyncore.dispatcher):
use_encoding
=
0
encoding
=
'latin1'
def
__init__
(
self
,
conn
=
None
):
def
__init__
(
self
,
sock
=
None
,
map
=
None
):
# for string terminator matching
self
.
ac_in_buffer
=
b
''
...
...
@@ -92,7 +92,7 @@ class async_chat (asyncore.dispatcher):
# we toss the use of the "simple producer" and replace it with
# a pure deque, which the original fifo was a wrapping of
self
.
producer_fifo
=
deque
()
asyncore
.
dispatcher
.
__init__
(
self
,
conn
)
asyncore
.
dispatcher
.
__init__
(
self
,
sock
,
map
)
def
collect_incoming_data
(
self
,
data
):
raise
NotImplementedError
(
"must be implemented in subclass"
)
...
...
Lib/asyncore.py
Dosyayı görüntüle @
9f2f8333
...
...
@@ -98,8 +98,10 @@ def readwrite(obj, flags):
obj
.
handle_read_event
()
if
flags
&
select
.
POLLOUT
:
obj
.
handle_write_event
()
if
flags
&
(
select
.
POLLERR
|
select
.
POLL
HUP
|
select
.
POLL
NVAL
):
if
flags
&
(
select
.
POLLERR
|
select
.
POLLNVAL
):
obj
.
handle_expt_event
()
if
flags
&
select
.
POLLHUP
:
obj
.
handle_close_event
()
except
(
ExitNow
,
KeyboardInterrupt
,
SystemExit
):
raise
except
:
...
...
@@ -466,7 +468,7 @@ class dispatcher:
),
'error'
)
self
.
close
()
self
.
handle_
close
()
def
handle_expt
(
self
):
self
.
log_info
(
'unhandled exception'
,
'warning'
)
...
...
Lib/test/test_asyncore.py
Dosyayı görüntüle @
9f2f8333
...
...
@@ -39,6 +39,7 @@ class exitingdummy:
raise
asyncore
.
ExitNow
()
handle_write_event
=
handle_read_event
handle_close_event
=
handle_read_event
handle_expt_event
=
handle_read_event
class
crashingdummy
:
...
...
@@ -49,6 +50,7 @@ class crashingdummy:
raise
Exception
()
handle_write_event
=
handle_read_event
handle_close_event
=
handle_read_event
handle_expt_event
=
handle_read_event
def
handle_error
(
self
):
...
...
@@ -118,6 +120,7 @@ class HelperFunctionTests(unittest.TestCase):
def
__init__
(
self
):
self
.
read
=
False
self
.
write
=
False
self
.
closed
=
False
self
.
expt
=
False
def
handle_read_event
(
self
):
...
...
@@ -126,6 +129,9 @@ class HelperFunctionTests(unittest.TestCase):
def
handle_write_event
(
self
):
self
.
write
=
True
def
handle_close_event
(
self
):
self
.
closed
=
True
def
handle_expt_event
(
self
):
self
.
expt
=
True
...
...
@@ -168,9 +174,9 @@ class HelperFunctionTests(unittest.TestCase):
for
flag
in
(
select
.
POLLERR
,
select
.
POLLHUP
,
select
.
POLLNVAL
):
tobj
=
testobj
()
self
.
assertEqual
(
tobj
.
expt
,
False
)
self
.
assertEqual
(
(
tobj
.
expt
,
tobj
.
closed
)[
flag
==
select
.
POLLHUP
]
,
False
)
asyncore
.
readwrite
(
tobj
,
flag
)
self
.
assertEqual
(
tobj
.
expt
,
True
)
self
.
assertEqual
(
(
tobj
.
expt
,
tobj
.
closed
)[
flag
==
select
.
POLLHUP
]
,
True
)
# check that ExitNow exceptions in the object handler method
# bubbles all the way up through asyncore readwrite calls
...
...
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