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
c357996d
Commit
c357996d
authored
Jun 07, 2020
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add gevent.selectors to index.
parent
b8bca6fa
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
20 deletions
+40
-20
CHANGES.rst
CHANGES.rst
+1
-0
docs/api/index.rst
docs/api/index.rst
+1
-0
src/gevent/_sslgte279.py
src/gevent/_sslgte279.py
+1
-0
src/gevent/tests/test__socket.py
src/gevent/tests/test__socket.py
+37
-20
No files found.
CHANGES.rst
View file @
c357996d
...
...
@@ -216,6 +216,7 @@ Bugfixes
particular, is using some additional socket functions and
defines. Please let the maintainers know if this introduces
issues.
See :issue:`1459`.
...
...
docs/api/index.rst
View file @
c357996d
...
...
@@ -20,6 +20,7 @@ Networking interfaces
gevent.socket
gevent.ssl
gevent.select
gevent.selectors
Synchronization primitives (locks, queues, events)
==================================================
...
...
src/gevent/_sslgte279.py
View file @
c357996d
...
...
@@ -19,6 +19,7 @@ _ssl = __ssl__._ssl # pylint:disable=no-member
import
errno
from
gevent._socket2
import
socket
from
gevent._socket2
import
AF_INET
from
gevent.socket
import
timeout_default
from
gevent.socket
import
create_connection
from
gevent.socket
import
error
as
socket_error
...
...
src/gevent/tests/test__socket.py
View file @
c357996d
...
...
@@ -12,6 +12,7 @@ import time
import
unittest
from
functools
import
wraps
import
gevent
from
gevent._compat
import
reraise
import
gevent.testing
as
greentest
...
...
@@ -31,12 +32,10 @@ from threading import Event
errno_types
=
int
class
BaseThread
(
object
):
terminal_exc
=
None
class
Thread
(
_Thread
):
def
__init__
(
self
,
**
kwargs
):
target
=
kwargs
.
pop
(
'target'
)
self
.
terminal_exc
=
None
def
__init__
(
self
,
target
):
@
wraps
(
target
)
def
errors_are_fatal
(
*
args
,
**
kwargs
):
try
:
...
...
@@ -44,10 +43,30 @@ class Thread(_Thread):
except
:
# pylint:disable=bare-except
self
.
terminal_exc
=
sys
.
exc_info
()
raise
self
.
target
=
errors_are_fatal
class
GreenletThread
(
BaseThread
):
def
__init__
(
self
,
target
=
None
,
args
=
()):
BaseThread
.
__init__
(
self
,
target
)
self
.
glet
=
gevent
.
spawn
(
self
.
target
,
*
args
)
_Thread
.
__init__
(
self
,
target
=
errors_are_fatal
,
**
kwargs
)
self
.
start
(
)
def
join
(
self
,
*
args
,
**
kwargs
):
return
self
.
glet
.
join
(
*
args
,
**
kwargs
)
def
is_alive
(
self
):
return
not
self
.
glet
.
ready
()
if
not
monkey
.
is_module_patched
(
'threading'
):
class
ThreadThread
(
BaseThread
,
_Thread
):
def
__init__
(
self
,
**
kwargs
):
target
=
kwargs
.
pop
(
'target'
)
BaseThread
.
__init__
(
self
,
target
)
_Thread
.
__init__
(
self
,
target
=
self
.
target
,
**
kwargs
)
self
.
start
()
Thread
=
ThreadThread
else
:
Thread
=
GreenletThread
class
TestTCP
(
greentest
.
TestCase
):
__timeout__
=
None
...
...
@@ -68,14 +87,15 @@ class TestTCP(greentest.TestCase):
if
not
printed
:
print
()
printed
.
append
(
1
)
print
(
"
\
t
->
"
,
now
(),
*
args
)
print
(
"
\
t
->
%0.6f"
%
now
(),
*
args
)
orig_cot
=
self
.
_close_on_teardown
def
cot
(
o
):
log
(
"Registering for teardown"
,
o
)
def
c
():
def
c
(
o
=
o
):
log
(
"Closing on teardown"
,
o
)
o
.
close
()
o
=
None
orig_cot
(
c
)
return
o
self
.
_close_on_teardown
=
cot
...
...
@@ -119,21 +139,21 @@ class TestTCP(greentest.TestCase):
**
client_args
):
# pylint:disable=too-many-locals,too-many-branches,too-many-statements
log
=
self
.
log
log
(
"
Sendall
"
,
client_method
)
log
(
"
test_sendall using method
"
,
client_method
)
read_data
=
[]
accepted_event
=
Event
()
def
accept_and_read
():
log
(
"accepting"
,
self
.
listener
)
log
(
"
\
t
accepting"
,
self
.
listener
)
conn
,
_
=
self
.
listener
.
accept
()
try
:
with
conn
.
makefile
(
mode
=
'rb'
)
as
r
:
log
(
"accepted on server"
,
conn
)
log
(
"
\
t
accepted on server"
,
conn
)
accepted_event
.
set
()
log
(
"reading"
)
log
(
"
\
t
reading"
)
read_data
.
append
(
r
.
read
())
log
(
"done reading"
)
log
(
"
\
t
done reading"
)
del
r
finally
:
conn
.
close
()
...
...
@@ -176,7 +196,6 @@ class TestTCP(greentest.TestCase):
try
:
getattr
(
client
,
client_method
)(
data
)
except
:
import
traceback
;
traceback
.
print_exc
()
# unwrapping might not work after this because we're in
# a bad state.
if
should_unwrap
:
...
...
@@ -536,17 +555,15 @@ class TestFunctions(greentest.TestCase):
# Creating new types in the function takes a cycle to cleanup.
def
test_wait_timeout
(
self
):
# Issue #635
import
gevent.socket
import
gevent._socketcommon
from
gevent
import
socket
as
gsocket
class
io
(
object
):
callback
=
None
def
start
(
self
,
*
_args
):
gevent
.
sleep
(
10
)
with
self
.
assertRaises
(
g
event
.
socket
.
timeout
):
g
event
.
socket
.
wait
(
io
(),
timeout
=
0.01
)
# pylint:disable=no-member
with
self
.
assertRaises
(
gsocket
.
timeout
):
gsocket
.
wait
(
io
(),
timeout
=
0.01
)
# pylint:disable=no-member
def
test_signatures
(
self
):
...
...
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