Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
c75efbec
Commit
c75efbec
authored
Feb 03, 2016
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Documentation for LoopExit [skip ci]
parent
5da86fd5
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
4 deletions
+43
-4
doc/gevent.hub.rst
doc/gevent.hub.rst
+2
-0
doc/gevent.socket.rst
doc/gevent.socket.rst
+4
-2
gevent/hub.py
gevent/hub.py
+17
-0
greentest/greentest.py
greentest/greentest.py
+16
-0
greentest/test__socket.py
greentest/test__socket.py
+4
-2
No files found.
doc/gevent.hub.rst
View file @
c75efbec
...
...
@@ -11,3 +11,5 @@
:undoc-members:
.. autoclass:: Waiter
.. autoclass:: LoopExit
doc/gevent.socket.rst
View file @
c75efbec
...
...
@@ -14,7 +14,7 @@ and let the others run.
socket). The results of attempting to use the socket in
another thread (for example, passing it to the
threadpool) are not defined (but one common outcome is a
``LoopExit`
` exception).
:exc:`~gevent.hub.LoopExit
` exception).
For convenience, exceptions (like :class:`error <socket.error>` and
:class:`timeout <socket.timeout>`) as well as the constants from the
...
...
@@ -52,7 +52,9 @@ functions not commonly used by many programs.
.. note:: These use the underlying libev ``io`` watchers, which means
that they share the same implementation limits. For example,
on some platforms they can be used with more than just
sockets, while on others the applicability is more limited.
sockets, while on others the applicability is more limited
(POSIX platforms like Linux and OS X can use pipes and fifos
but Windows is limited to sockets).
.. autofunction:: gevent.socket.wait_read
.. autofunction:: gevent.socket.wait_write
...
...
gevent/hub.py
View file @
c75efbec
...
...
@@ -87,6 +87,23 @@ _NONE = _NONE()
class
LoopExit
(
Exception
):
"""
Exception thrown when the hub finishes running.
In a normal application, this is never thrown or caught
explicitly. The internal implementation of functions like
:func:`join` and :func:`joinall` may catch it, but user code
generally should not.
.. caution::
Errors in application programming can also lead to this exception being
raised. Some examples include (but are not limited too):
- greenlets deadlocking on a lock;
- using a socket or other gevent object with native thread
affinity from a different thread
"""
pass
...
...
greentest/greentest.py
View file @
c75efbec
...
...
@@ -333,6 +333,7 @@ class TestCase(TestCaseMetaClass("NewBase", (BaseTestCase,), {})):
__timeout__
=
1
if
not
RUNNING_ON_CI
else
5
switch_expected
=
'default'
error_fatal
=
True
close_on_teardown
=
()
def
run
(
self
,
*
args
,
**
kwargs
):
if
self
.
switch_expected
==
'default'
:
...
...
@@ -345,6 +346,21 @@ class TestCase(TestCaseMetaClass("NewBase", (BaseTestCase,), {})):
if
hasattr
(
self
,
'cleanup'
):
self
.
cleanup
()
self
.
_error
=
self
.
_none
for
x
in
self
.
close_on_teardown
:
try
:
x
.
close
()
except
Exception
:
pass
try
:
del
self
.
close_on_teardown
except
AttributeError
:
pass
def
_close_on_teardown
(
self
,
resource
):
if
'close_on_teardown'
not
in
self
.
__dict__
:
self
.
close_on_teardown
=
[]
self
.
close_on_teardown
.
append
(
resource
)
return
resource
@
property
def
testname
(
self
):
...
...
greentest/test__socket.py
View file @
c75efbec
...
...
@@ -58,9 +58,11 @@ class TestTCP(greentest.TestCase):
pass
del
self
.
listener
def
create_connection
(
self
):
def
create_connection
(
self
,
port
=
None
,
timeout
=
None
):
sock
=
socket
.
socket
()
sock
.
connect
((
'127.0.0.1'
,
self
.
port
))
sock
.
connect
((
'127.0.0.1'
,
port
or
self
.
port
))
if
timeout
is
not
None
:
sock
.
settimeout
(
timeout
)
return
sock
def
_test_sendall
(
self
,
data
):
...
...
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