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):
#print('%s: sent %s [%d%%]' % (out_fd, sent, 100*total_sent/count))
total_sent
+=
sent
except
OSError
as
ex
:
if
ex
[
0
]
==
EAGAIN
:
if
ex
.
args
[
0
]
==
EAGAIN
:
wait_write
(
out_fd
)
else
:
raise
...
...
gevent/baseserver.py
View file @
2960692c
...
...
@@ -284,7 +284,7 @@ class BaseServer(object):
Greenlet
.
spawn
(
self
.
stop
,
timeout
=
stop_timeout
).
join
()
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
):
...
...
gevent/server.py
View file @
2960692c
...
...
@@ -92,7 +92,7 @@ class StreamServer(BaseServer):
try
:
client_socket
,
address
=
self
.
socket
.
accept
()
except
_socket
.
error
as
err
:
if
err
[
0
]
==
EWOULDBLOCK
:
if
err
.
args
[
0
]
==
EWOULDBLOCK
:
return
raise
return
socket
(
_sock
=
client_socket
),
address
...
...
@@ -131,7 +131,7 @@ class DatagramServer(BaseServer):
try
:
data
,
address
=
self
.
_socket
.
recvfrom
(
8192
)
except
_socket
.
error
as
err
:
if
err
[
0
]
==
EWOULDBLOCK
:
if
err
.
args
[
0
]
==
EWOULDBLOCK
:
return
raise
return
data
,
address
...
...
gevent/socket.py
View file @
2960692c
...
...
@@ -303,7 +303,7 @@ class socket(object):
client_socket
,
address
=
sock
.
accept
()
break
except
error
as
ex
:
if
ex
[
0
]
!=
EWOULDBLOCK
or
self
.
timeout
==
0.0
:
if
ex
.
args
[
0
]
!=
EWOULDBLOCK
or
self
.
timeout
==
0.0
:
raise
sys
.
exc_clear
()
self
.
_wait
(
self
.
_read_event
)
...
...
gevent/ssl.py
View file @
2960692c
...
...
@@ -71,7 +71,7 @@ class SSLSocket(socket):
try
:
socket
.
getpeername
(
self
)
except
socket_error
as
e
:
if
e
[
0
]
!=
errno
.
ENOTCONN
:
if
e
.
args
[
0
]
!=
errno
.
ENOTCONN
:
raise
# no, no connection yet
self
.
_sslobj
=
None
...
...
greentest/test__socket_ex.py
View file @
2960692c
...
...
@@ -12,7 +12,7 @@ class TestClosedSocket(greentest.TestCase):
try
:
sock
.
send
(
'a'
,
timeout
=
1
)
except
socket
.
error
as
ex
:
if
ex
[
0
]
!=
9
:
if
ex
.
args
[
0
]
!=
9
:
raise
...
...
greentest/test__socket_timeout.py
View file @
2960692c
...
...
@@ -31,7 +31,6 @@ class Test(greentest.TestCase):
except
socket
.
error
as
ex
:
self
.
assertEqual
(
ex
.
args
,
(
'timed out'
,))
self
.
assertEqual
(
str
(
ex
),
'timed out'
)
self
.
assertEqual
(
ex
[
0
],
'timed out'
)
finally
:
sock
.
close
()
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