Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
010f361d
Commit
010f361d
authored
May 20, 2016
by
Yury Selivanov
Browse files
Options
Browse Files
Download
Plain Diff
Merge 3.5 (asyncio)
parents
742206d9
eaaaee8c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
Lib/asyncio/base_events.py
Lib/asyncio/base_events.py
+5
-0
Lib/test/test_asyncio/test_base_events.py
Lib/test/test_asyncio/test_base_events.py
+22
-0
No files found.
Lib/asyncio/base_events.py
View file @
010f361d
...
...
@@ -102,6 +102,11 @@ def _ipaddr_info(host, port, family, type, proto):
else
:
return
None
if
port
in
{
None
,
''
}:
port
=
0
elif
isinstance
(
port
,
(
bytes
,
str
)):
port
=
int
(
port
)
if
hasattr
(
socket
,
'inet_pton'
):
if
family
==
socket
.
AF_UNSPEC
:
afs
=
[
socket
.
AF_INET
,
socket
.
AF_INET6
]
...
...
Lib/test/test_asyncio/test_base_events.py
View file @
010f361d
...
...
@@ -120,6 +120,28 @@ class BaseEventTests(test_utils.TestCase):
(
INET6
,
STREAM
,
TCP
,
''
,
(
'::3%lo0'
,
1
)),
base_events
.
_ipaddr_info
(
'::3%lo0'
,
1
,
INET6
,
STREAM
,
TCP
))
def
test_port_parameter_types
(
self
):
# Test obscure kinds of arguments for "port".
INET
=
socket
.
AF_INET
STREAM
=
socket
.
SOCK_STREAM
TCP
=
socket
.
IPPROTO_TCP
self
.
assertEqual
(
(
INET
,
STREAM
,
TCP
,
''
,
(
'1.2.3.4'
,
0
)),
base_events
.
_ipaddr_info
(
'1.2.3.4'
,
None
,
INET
,
STREAM
,
TCP
))
self
.
assertEqual
(
(
INET
,
STREAM
,
TCP
,
''
,
(
'1.2.3.4'
,
0
)),
base_events
.
_ipaddr_info
(
'1.2.3.4'
,
''
,
INET
,
STREAM
,
TCP
))
self
.
assertEqual
(
(
INET
,
STREAM
,
TCP
,
''
,
(
'1.2.3.4'
,
1
)),
base_events
.
_ipaddr_info
(
'1.2.3.4'
,
'1'
,
INET
,
STREAM
,
TCP
))
self
.
assertEqual
(
(
INET
,
STREAM
,
TCP
,
''
,
(
'1.2.3.4'
,
1
)),
base_events
.
_ipaddr_info
(
'1.2.3.4'
,
b'1'
,
INET
,
STREAM
,
TCP
))
@
patch_socket
def
test_ipaddr_info_no_inet_pton
(
self
,
m_socket
):
del
m_socket
.
inet_pton
...
...
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