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
2960692c
Commit
2960692c
authored
Feb 10, 2014
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #366 from fantix/ex_args
Fix indexing exceptions (ex[0]) by using args (ex.args[0]), refs #38
parents
b48db7d1
0911fe3e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
7 additions
and
8 deletions
+7
-8
examples/geventsendfile.py
examples/geventsendfile.py
+1
-1
gevent/baseserver.py
gevent/baseserver.py
+1
-1
gevent/server.py
gevent/server.py
+2
-2
gevent/socket.py
gevent/socket.py
+1
-1
gevent/ssl.py
gevent/ssl.py
+1
-1
greentest/test__socket_ex.py
greentest/test__socket_ex.py
+1
-1
greentest/test__socket_timeout.py
greentest/test__socket_timeout.py
+0
-1
No files found.
examples/geventsendfile.py
View file @
2960692c
...
@@ -15,7 +15,7 @@ def gevent_sendfile(out_fd, in_fd, offset, count):
...
@@ -15,7 +15,7 @@ def gevent_sendfile(out_fd, in_fd, offset, count):
#print('%s: sent %s [%d%%]' % (out_fd, sent, 100*total_sent/count))
#print('%s: sent %s [%d%%]' % (out_fd, sent, 100*total_sent/count))
total_sent
+=
sent
total_sent
+=
sent
except
OSError
as
ex
:
except
OSError
as
ex
:
if
ex
[
0
]
==
EAGAIN
:
if
ex
.
args
[
0
]
==
EAGAIN
:
wait_write
(
out_fd
)
wait_write
(
out_fd
)
else
:
else
:
raise
raise
...
...
gevent/baseserver.py
View file @
2960692c
...
@@ -284,7 +284,7 @@ class BaseServer(object):
...
@@ -284,7 +284,7 @@ class BaseServer(object):
Greenlet
.
spawn
(
self
.
stop
,
timeout
=
stop_timeout
).
join
()
Greenlet
.
spawn
(
self
.
stop
,
timeout
=
stop_timeout
).
join
()
def
is_fatal_error
(
self
,
ex
):
def
is_fatal_error
(
self
,
ex
):
return
isinstance
(
ex
,
_socket
.
error
)
and
ex
[
0
]
in
self
.
fatal_errors
return
isinstance
(
ex
,
_socket
.
error
)
and
ex
.
args
[
0
]
in
self
.
fatal_errors
def
_extract_family
(
host
):
def
_extract_family
(
host
):
...
...
gevent/server.py
View file @
2960692c
...
@@ -92,7 +92,7 @@ class StreamServer(BaseServer):
...
@@ -92,7 +92,7 @@ class StreamServer(BaseServer):
try
:
try
:
client_socket
,
address
=
self
.
socket
.
accept
()
client_socket
,
address
=
self
.
socket
.
accept
()
except
_socket
.
error
as
err
:
except
_socket
.
error
as
err
:
if
err
[
0
]
==
EWOULDBLOCK
:
if
err
.
args
[
0
]
==
EWOULDBLOCK
:
return
return
raise
raise
return
socket
(
_sock
=
client_socket
),
address
return
socket
(
_sock
=
client_socket
),
address
...
@@ -131,7 +131,7 @@ class DatagramServer(BaseServer):
...
@@ -131,7 +131,7 @@ class DatagramServer(BaseServer):
try
:
try
:
data
,
address
=
self
.
_socket
.
recvfrom
(
8192
)
data
,
address
=
self
.
_socket
.
recvfrom
(
8192
)
except
_socket
.
error
as
err
:
except
_socket
.
error
as
err
:
if
err
[
0
]
==
EWOULDBLOCK
:
if
err
.
args
[
0
]
==
EWOULDBLOCK
:
return
return
raise
raise
return
data
,
address
return
data
,
address
...
...
gevent/socket.py
View file @
2960692c
...
@@ -303,7 +303,7 @@ class socket(object):
...
@@ -303,7 +303,7 @@ class socket(object):
client_socket
,
address
=
sock
.
accept
()
client_socket
,
address
=
sock
.
accept
()
break
break
except
error
as
ex
:
except
error
as
ex
:
if
ex
[
0
]
!=
EWOULDBLOCK
or
self
.
timeout
==
0.0
:
if
ex
.
args
[
0
]
!=
EWOULDBLOCK
or
self
.
timeout
==
0.0
:
raise
raise
sys
.
exc_clear
()
sys
.
exc_clear
()
self
.
_wait
(
self
.
_read_event
)
self
.
_wait
(
self
.
_read_event
)
...
...
gevent/ssl.py
View file @
2960692c
...
@@ -71,7 +71,7 @@ class SSLSocket(socket):
...
@@ -71,7 +71,7 @@ class SSLSocket(socket):
try
:
try
:
socket
.
getpeername
(
self
)
socket
.
getpeername
(
self
)
except
socket_error
as
e
:
except
socket_error
as
e
:
if
e
[
0
]
!=
errno
.
ENOTCONN
:
if
e
.
args
[
0
]
!=
errno
.
ENOTCONN
:
raise
raise
# no, no connection yet
# no, no connection yet
self
.
_sslobj
=
None
self
.
_sslobj
=
None
...
...
greentest/test__socket_ex.py
View file @
2960692c
...
@@ -12,7 +12,7 @@ class TestClosedSocket(greentest.TestCase):
...
@@ -12,7 +12,7 @@ class TestClosedSocket(greentest.TestCase):
try
:
try
:
sock
.
send
(
'a'
,
timeout
=
1
)
sock
.
send
(
'a'
,
timeout
=
1
)
except
socket
.
error
as
ex
:
except
socket
.
error
as
ex
:
if
ex
[
0
]
!=
9
:
if
ex
.
args
[
0
]
!=
9
:
raise
raise
...
...
greentest/test__socket_timeout.py
View file @
2960692c
...
@@ -31,7 +31,6 @@ class Test(greentest.TestCase):
...
@@ -31,7 +31,6 @@ class Test(greentest.TestCase):
except
socket
.
error
as
ex
:
except
socket
.
error
as
ex
:
self
.
assertEqual
(
ex
.
args
,
(
'timed out'
,))
self
.
assertEqual
(
ex
.
args
,
(
'timed out'
,))
self
.
assertEqual
(
str
(
ex
),
'timed out'
)
self
.
assertEqual
(
str
(
ex
),
'timed out'
)
self
.
assertEqual
(
ex
[
0
],
'timed out'
)
finally
:
finally
:
sock
.
close
()
sock
.
close
()
finally
:
finally
:
...
...
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