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
47a31554
Commit
47a31554
authored
Apr 06, 2017
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix argument names for socketpair and fromfd. Exclude differences on PyPy.
parent
21a3bb0d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
8 deletions
+27
-8
CHANGES.rst
CHANGES.rst
+8
-1
src/gevent/_socket2.py
src/gevent/_socket2.py
+5
-4
src/gevent/_socketcommon.py
src/gevent/_socketcommon.py
+1
-1
src/greentest/greentest.py
src/greentest/greentest.py
+3
-1
src/greentest/test__socket.py
src/greentest/test__socket.py
+10
-1
No files found.
CHANGES.rst
View file @
47a31554
...
@@ -19,7 +19,14 @@
...
@@ -19,7 +19,14 @@
- Fix the name of the ``type`` parameter to
- Fix the name of the ``type`` parameter to
:func:`gevent.socket.getaddrinfo` to be correct on Python 3. This
:func:`gevent.socket.getaddrinfo` to be correct on Python 3. This
would cause callers using keyword arguments to raise a :exc:`TypeError`.
would cause callers using keyword arguments to raise a :exc:`TypeError`.
Reported in :issue:`960` by js6626069.
Reported in :issue:`960` by js6626069. Likewise, correct the
argument names for ``fromfd`` and ``socketpair`` on Python 2,
although they cannot be called wit keyword arguments under CPython.
.. note:: The ``gethost*`` functions take different argument names
under CPython and PyPy. gevent follows the CPython
convention, although these functions cannot be called with
keyword arguments on CPython.
1.2.1 (2017-01-12)
1.2.1 (2017-01-12)
==================
==================
...
...
src/gevent/_socket2.py
View file @
47a31554
...
@@ -499,8 +499,9 @@ SocketType = socket
...
@@ -499,8 +499,9 @@ SocketType = socket
if
hasattr
(
_socket
,
'socketpair'
):
if
hasattr
(
_socket
,
'socketpair'
):
def
socketpair
(
*
args
):
def
socketpair
(
family
=
getattr
(
_socket
,
'AF_UNIX'
,
_socket
.
AF_INET
),
one
,
two
=
_socket
.
socketpair
(
*
args
)
type
=
_socket
.
SOCK_STREAM
,
proto
=
0
):
one
,
two
=
_socket
.
socketpair
(
family
,
type
,
proto
)
result
=
socket
(
_sock
=
one
),
socket
(
_sock
=
two
)
result
=
socket
(
_sock
=
one
),
socket
(
_sock
=
two
)
if
PYPY
:
if
PYPY
:
one
.
_drop
()
one
.
_drop
()
...
@@ -511,8 +512,8 @@ elif 'socketpair' in __implements__:
...
@@ -511,8 +512,8 @@ elif 'socketpair' in __implements__:
if
hasattr
(
_socket
,
'fromfd'
):
if
hasattr
(
_socket
,
'fromfd'
):
def
fromfd
(
*
args
):
def
fromfd
(
fd
,
family
,
type
,
proto
=
0
):
s
=
_socket
.
fromfd
(
*
args
)
s
=
_socket
.
fromfd
(
fd
,
family
,
type
,
proto
)
result
=
socket
(
_sock
=
s
)
result
=
socket
(
_sock
=
s
)
if
PYPY
:
if
PYPY
:
s
.
_drop
()
s
.
_drop
()
...
...
src/gevent/_socketcommon.py
View file @
47a31554
...
@@ -288,7 +288,7 @@ if PY3:
...
@@ -288,7 +288,7 @@ if PY3:
def
gethostbyaddr
(
ip_address
):
def
gethostbyaddr
(
ip_address
):
"""
"""
gethostbyaddr(
host
) -> (name, aliaslist, addresslist)
gethostbyaddr(
ip_address
) -> (name, aliaslist, addresslist)
Return the true host name, a list of aliases, and a list of IP addresses,
Return the true host name, a list of aliases, and a list of IP addresses,
for a host. The host argument is a string giving a host name or IP number.
for a host. The host argument is a string giving a host name or IP number.
...
...
src/greentest/greentest.py
View file @
47a31554
...
@@ -461,7 +461,7 @@ class TestCase(TestCaseMetaClass("NewBase", (BaseTestCase,), {})):
...
@@ -461,7 +461,7 @@ class TestCase(TestCaseMetaClass("NewBase", (BaseTestCase,), {})):
self
.
assertGreaterEqual
(
delay
,
min_time
)
self
.
assertGreaterEqual
(
delay
,
min_time
)
def
assertMonkeyPatchedFuncSignatures
(
self
,
mod_name
,
*
func_names
):
def
assertMonkeyPatchedFuncSignatures
(
self
,
mod_name
,
func_names
=
(),
exclude
=
()
):
# We use inspect.getargspec because it's the only thing available
# We use inspect.getargspec because it's the only thing available
# in Python 2.7, but it is deprecated
# in Python 2.7, but it is deprecated
# pylint:disable=deprecated-method
# pylint:disable=deprecated-method
...
@@ -478,6 +478,8 @@ class TestCase(TestCaseMetaClass("NewBase", (BaseTestCase,), {})):
...
@@ -478,6 +478,8 @@ class TestCase(TestCaseMetaClass("NewBase", (BaseTestCase,), {})):
func_names
=
getattr
(
gevent_module
,
'__implements__'
)
func_names
=
getattr
(
gevent_module
,
'__implements__'
)
for
func_name
in
func_names
:
for
func_name
in
func_names
:
if
func_name
in
exclude
:
continue
gevent_func
=
getattr
(
gevent_module
,
func_name
)
gevent_func
=
getattr
(
gevent_module
,
func_name
)
if
not
inspect
.
isfunction
(
gevent_func
)
and
not
funcs_given
:
if
not
inspect
.
isfunction
(
gevent_func
)
and
not
funcs_given
:
continue
continue
...
...
src/greentest/test__socket.py
View file @
47a31554
...
@@ -365,7 +365,16 @@ class TestFunctions(greentest.TestCase):
...
@@ -365,7 +365,16 @@ class TestFunctions(greentest.TestCase):
def
test_signatures
(
self
):
def
test_signatures
(
self
):
# https://github.com/gevent/gevent/issues/960
# https://github.com/gevent/gevent/issues/960
self
.
assertMonkeyPatchedFuncSignatures
(
'socket'
)
exclude
=
[]
if
greentest
.
PYPY
:
# Up through at least PyPy 5.7.1, they define these as
# gethostbyname(host), whereas the official CPython argument name
# is hostname. But cpython doesn't allow calling with keyword args.
# Likewise for gethostbyaddr: PyPy uses host, cpython uses ip_address
exclude
.
append
(
'gethostbyname'
)
exclude
.
append
(
'gethostbyname_ex'
)
exclude
.
append
(
'gethostbyaddr'
)
self
.
assertMonkeyPatchedFuncSignatures
(
'socket'
,
exclude
=
exclude
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
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