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
f97e8293
Kaydet (Commit)
f97e8293
authored
Mar 20, 2014
tarafından
Giampaolo Rodola'
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix issue 18931: selectors module now supports /dev/poll on Solaris.
üst
5782e25d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
2 deletions
+84
-2
selectors.rst
Doc/library/selectors.rst
+11
-0
selectors.py
Lib/selectors.py
+61
-1
test_selectors.py
Lib/test/test_selectors.py
+9
-1
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/selectors.rst
Dosyayı görüntüle @
f97e8293
...
@@ -45,6 +45,7 @@ Classes hierarchy::
...
@@ -45,6 +45,7 @@ Classes hierarchy::
+-- SelectSelector
+-- SelectSelector
+-- PollSelector
+-- PollSelector
+-- EpollSelector
+-- EpollSelector
+-- DevpollSelector
+-- KqueueSelector
+-- KqueueSelector
...
@@ -207,6 +208,16 @@ below:
...
@@ -207,6 +208,16 @@ below:
This returns the file descriptor used by the underlying
This returns the file descriptor used by the underlying
:func:`select.epoll` object.
:func:`select.epoll` object.
.. class:: DevpollSelector()
:func:`select.devpoll`-based selector.
.. method:: fileno()
This returns the file descriptor used by the underlying
:func:`select.devpoll` object.
.. versionadded:: 3.5
.. class:: KqueueSelector()
.. class:: KqueueSelector()
...
...
Lib/selectors.py
Dosyayı görüntüle @
f97e8293
...
@@ -441,6 +441,64 @@ if hasattr(select, 'epoll'):
...
@@ -441,6 +441,64 @@ if hasattr(select, 'epoll'):
super
()
.
close
()
super
()
.
close
()
if
hasattr
(
select
,
'devpoll'
):
class
DevpollSelector
(
_BaseSelectorImpl
):
"""Solaris /dev/poll selector."""
def
__init__
(
self
):
super
()
.
__init__
()
self
.
_devpoll
=
select
.
devpoll
()
def
fileno
(
self
):
return
self
.
_devpoll
.
fileno
()
def
register
(
self
,
fileobj
,
events
,
data
=
None
):
key
=
super
()
.
register
(
fileobj
,
events
,
data
)
poll_events
=
0
if
events
&
EVENT_READ
:
poll_events
|=
select
.
POLLIN
if
events
&
EVENT_WRITE
:
poll_events
|=
select
.
POLLOUT
self
.
_devpoll
.
register
(
key
.
fd
,
poll_events
)
return
key
def
unregister
(
self
,
fileobj
):
key
=
super
()
.
unregister
(
fileobj
)
self
.
_devpoll
.
unregister
(
key
.
fd
)
return
key
def
select
(
self
,
timeout
=
None
):
if
timeout
is
None
:
timeout
=
None
elif
timeout
<=
0
:
timeout
=
0
else
:
# devpoll() has a resolution of 1 millisecond, round away from
# zero to wait *at least* timeout seconds.
timeout
=
math
.
ceil
(
timeout
*
1e3
)
ready
=
[]
try
:
fd_event_list
=
self
.
_devpoll
.
poll
(
timeout
)
except
InterruptedError
:
return
ready
for
fd
,
event
in
fd_event_list
:
events
=
0
if
event
&
~
select
.
POLLIN
:
events
|=
EVENT_WRITE
if
event
&
~
select
.
POLLOUT
:
events
|=
EVENT_READ
key
=
self
.
_key_from_fd
(
fd
)
if
key
:
ready
.
append
((
key
,
events
&
key
.
events
))
return
ready
def
close
(
self
):
self
.
_devpoll
.
close
()
super
()
.
close
()
if
hasattr
(
select
,
'kqueue'
):
if
hasattr
(
select
,
'kqueue'
):
class
KqueueSelector
(
_BaseSelectorImpl
):
class
KqueueSelector
(
_BaseSelectorImpl
):
...
@@ -513,12 +571,14 @@ if hasattr(select, 'kqueue'):
...
@@ -513,12 +571,14 @@ if hasattr(select, 'kqueue'):
super
()
.
close
()
super
()
.
close
()
# Choose the best implementation: roughly, epoll|kqueue > poll > select.
# Choose the best implementation: roughly, epoll|kqueue
|devpoll
> poll > select.
# select() also can't accept a FD > FD_SETSIZE (usually around 1024)
# select() also can't accept a FD > FD_SETSIZE (usually around 1024)
if
'KqueueSelector'
in
globals
():
if
'KqueueSelector'
in
globals
():
DefaultSelector
=
KqueueSelector
DefaultSelector
=
KqueueSelector
elif
'EpollSelector'
in
globals
():
elif
'EpollSelector'
in
globals
():
DefaultSelector
=
EpollSelector
DefaultSelector
=
EpollSelector
elif
'DevpollSelector'
in
globals
():
DefaultSelector
=
DevpollSelector
elif
'PollSelector'
in
globals
():
elif
'PollSelector'
in
globals
():
DefaultSelector
=
PollSelector
DefaultSelector
=
PollSelector
else
:
else
:
...
...
Lib/test/test_selectors.py
Dosyayı görüntüle @
f97e8293
...
@@ -441,10 +441,18 @@ class KqueueSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn):
...
@@ -441,10 +441,18 @@ class KqueueSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn):
SELECTOR
=
getattr
(
selectors
,
'KqueueSelector'
,
None
)
SELECTOR
=
getattr
(
selectors
,
'KqueueSelector'
,
None
)
@unittest.skipUnless
(
hasattr
(
selectors
,
'DevpollSelector'
),
"Test needs selectors.DevpollSelector"
)
class
DevpollSelectorTestCase
(
BaseSelectorTestCase
,
ScalableSelectorMixIn
):
SELECTOR
=
getattr
(
selectors
,
'DevpollSelector'
,
None
)
def
test_main
():
def
test_main
():
tests
=
[
DefaultSelectorTestCase
,
SelectSelectorTestCase
,
tests
=
[
DefaultSelectorTestCase
,
SelectSelectorTestCase
,
PollSelectorTestCase
,
EpollSelectorTestCase
,
PollSelectorTestCase
,
EpollSelectorTestCase
,
KqueueSelectorTestCase
]
KqueueSelectorTestCase
,
DevpollSelectorTestCase
]
support
.
run_unittest
(
*
tests
)
support
.
run_unittest
(
*
tests
)
support
.
reap_children
()
support
.
reap_children
()
...
...
Misc/NEWS
Dosyayı görüntüle @
f97e8293
...
@@ -23,6 +23,9 @@ Core and Builtins
...
@@ -23,6 +23,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue 18931: selectors module now supports /dev/poll on Solaris.
Patch by Giampaolo Rodola'
.
-
Issue
#
19977
:
When
the
``
LC_TYPE
``
locale
is
the
POSIX
locale
(``
C
``
locale
),
-
Issue
#
19977
:
When
the
``
LC_TYPE
``
locale
is
the
POSIX
locale
(``
C
``
locale
),
:
py
:
data
:`
sys
.
stdin
`
and
:
py
:
data
:`
sys
.
stdout
`
are
now
using
the
:
py
:
data
:`
sys
.
stdin
`
and
:
py
:
data
:`
sys
.
stdout
`
are
now
using
the
``
surrogateescape
``
error
handler
,
instead
of
the
``
strict
``
error
handler
.
``
surrogateescape
``
error
handler
,
instead
of
the
``
strict
``
error
handler
.
...
...
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