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
09bb89b8
Kaydet (Commit)
09bb89b8
authored
Ara 15, 2012
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #16488: epoll() objects now support the `with` statement.
Patch by Serhiy Storchaka.
üst
c48e81ed
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
1 deletion
+36
-1
select.rst
Doc/library/select.rst
+4
-1
test_epoll.py
Lib/test/test_epoll.py
+7
-0
NEWS
Misc/NEWS
+3
-0
selectmodule.c
Modules/selectmodule.c
+22
-0
No files found.
Doc/library/select.rst
Dosyayı görüntüle @
09bb89b8
...
@@ -47,11 +47,14 @@ The module defines the following:
...
@@ -47,11 +47,14 @@ The module defines the following:
to :const:`EPOLL_CLOEXEC`, which causes the epoll descriptor to be closed
to :const:`EPOLL_CLOEXEC`, which causes the epoll descriptor to be closed
automatically when :func:`os.execve` is called. See section
automatically when :func:`os.execve` is called. See section
:ref:`epoll-objects` below for the methods supported by epolling objects.
:ref:`epoll-objects` below for the methods supported by epolling objects.
They also support the :keyword:`with` statement.
.. versionchanged:: 3.3
.. versionchanged:: 3.3
Added the *flags* parameter.
Added the *flags* parameter.
.. versionchanged:: 3.4
Support for the :keyword:`with` statement was added.
.. function:: poll()
.. function:: poll()
...
...
Lib/test/test_epoll.py
Dosyayı görüntüle @
09bb89b8
...
@@ -87,6 +87,13 @@ class TestEPoll(unittest.TestCase):
...
@@ -87,6 +87,13 @@ class TestEPoll(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
select
.
epoll
,
[
'foo'
])
self
.
assertRaises
(
TypeError
,
select
.
epoll
,
[
'foo'
])
self
.
assertRaises
(
TypeError
,
select
.
epoll
,
{})
self
.
assertRaises
(
TypeError
,
select
.
epoll
,
{})
def
test_context_manager
(
self
):
with
select
.
epoll
(
16
)
as
ep
:
self
.
assertGreater
(
ep
.
fileno
(),
0
)
self
.
assertFalse
(
ep
.
closed
)
self
.
assertTrue
(
ep
.
closed
)
self
.
assertRaises
(
ValueError
,
ep
.
fileno
)
def
test_add
(
self
):
def
test_add
(
self
):
server
,
client
=
self
.
_connected_pair
()
server
,
client
=
self
.
_connected_pair
()
...
...
Misc/NEWS
Dosyayı görüntüle @
09bb89b8
...
@@ -167,6 +167,9 @@ Core and Builtins
...
@@ -167,6 +167,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #16488: epoll() objects now support the `with` statement. Patch
by Serhiy Storchaka.
- Issue #16298: In HTTPResponse.read(), close the socket when there is no
- Issue #16298: In HTTPResponse.read(), close the socket when there is no
Content-Length and the incoming stream is finished. Patch by Eran
Content-Length and the incoming stream is finished. Patch by Eran
Rundstein.
Rundstein.
...
...
Modules/selectmodule.c
Dosyayı görüntüle @
09bb89b8
...
@@ -1394,6 +1394,24 @@ Wait for events on the epoll file descriptor for a maximum time of timeout\n\
...
@@ -1394,6 +1394,24 @@ Wait for events on the epoll file descriptor for a maximum time of timeout\n\
in seconds (as float). -1 makes poll wait indefinitely.
\n
\
in seconds (as float). -1 makes poll wait indefinitely.
\n
\
Up to maxevents are returned to the caller."
);
Up to maxevents are returned to the caller."
);
static
PyObject
*
pyepoll_enter
(
pyEpoll_Object
*
self
,
PyObject
*
args
)
{
if
(
self
->
epfd
<
0
)
return
pyepoll_err_closed
();
Py_INCREF
(
self
);
return
(
PyObject
*
)
self
;
}
static
PyObject
*
pyepoll_exit
(
PyObject
*
self
,
PyObject
*
args
)
{
_Py_IDENTIFIER
(
close
);
return
_PyObject_CallMethodId
(
self
,
&
PyId_close
,
NULL
);
}
static
PyMethodDef
pyepoll_methods
[]
=
{
static
PyMethodDef
pyepoll_methods
[]
=
{
{
"fromfd"
,
(
PyCFunction
)
pyepoll_fromfd
,
{
"fromfd"
,
(
PyCFunction
)
pyepoll_fromfd
,
METH_VARARGS
|
METH_CLASS
,
pyepoll_fromfd_doc
},
METH_VARARGS
|
METH_CLASS
,
pyepoll_fromfd_doc
},
...
@@ -1409,6 +1427,10 @@ static PyMethodDef pyepoll_methods[] = {
...
@@ -1409,6 +1427,10 @@ static PyMethodDef pyepoll_methods[] = {
METH_VARARGS
|
METH_KEYWORDS
,
pyepoll_unregister_doc
},
METH_VARARGS
|
METH_KEYWORDS
,
pyepoll_unregister_doc
},
{
"poll"
,
(
PyCFunction
)
pyepoll_poll
,
{
"poll"
,
(
PyCFunction
)
pyepoll_poll
,
METH_VARARGS
|
METH_KEYWORDS
,
pyepoll_poll_doc
},
METH_VARARGS
|
METH_KEYWORDS
,
pyepoll_poll_doc
},
{
"__enter__"
,
(
PyCFunction
)
pyepoll_enter
,
METH_NOARGS
,
NULL
},
{
"__exit__"
,
(
PyCFunction
)
pyepoll_exit
,
METH_VARARGS
,
NULL
},
{
NULL
,
NULL
},
{
NULL
,
NULL
},
};
};
...
...
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