Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
1f56e5f6
Kaydet (Commit)
1f56e5f6
authored
Haz 02, 2016
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge 3.5 (asyncio)
üst
642afb3d
a714616d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
3 deletions
+39
-3
base_events.py
Lib/asyncio/base_events.py
+19
-3
test_base_events.py
Lib/test/test_asyncio/test_base_events.py
+20
-0
No files found.
Lib/asyncio/base_events.py
Dosyayı görüntüle @
1f56e5f6
...
@@ -102,10 +102,26 @@ def _ipaddr_info(host, port, family, type, proto):
...
@@ -102,10 +102,26 @@ def _ipaddr_info(host, port, family, type, proto):
else
:
else
:
return
None
return
None
if
port
i
n
{
None
,
''
,
b
''
}
:
if
port
i
s
None
:
port
=
0
port
=
0
elif
isinstance
(
port
,
(
bytes
,
str
)):
elif
isinstance
(
port
,
bytes
):
port
=
int
(
port
)
if
port
==
b
''
:
port
=
0
else
:
try
:
port
=
int
(
port
)
except
ValueError
:
# Might be a service name like b"http".
port
=
socket
.
getservbyname
(
port
.
decode
(
'ascii'
))
elif
isinstance
(
port
,
str
):
if
port
==
''
:
port
=
0
else
:
try
:
port
=
int
(
port
)
except
ValueError
:
# Might be a service name like "http".
port
=
socket
.
getservbyname
(
port
)
if
hasattr
(
socket
,
'inet_pton'
):
if
hasattr
(
socket
,
'inet_pton'
):
if
family
==
socket
.
AF_UNSPEC
:
if
family
==
socket
.
AF_UNSPEC
:
...
...
Lib/test/test_asyncio/test_base_events.py
Dosyayı görüntüle @
1f56e5f6
...
@@ -146,6 +146,26 @@ class BaseEventTests(test_utils.TestCase):
...
@@ -146,6 +146,26 @@ class BaseEventTests(test_utils.TestCase):
(
INET
,
STREAM
,
TCP
,
''
,
(
'1.2.3.4'
,
1
)),
(
INET
,
STREAM
,
TCP
,
''
,
(
'1.2.3.4'
,
1
)),
base_events
.
_ipaddr_info
(
'1.2.3.4'
,
b
'1'
,
INET
,
STREAM
,
TCP
))
base_events
.
_ipaddr_info
(
'1.2.3.4'
,
b
'1'
,
INET
,
STREAM
,
TCP
))
def
test_getaddrinfo_servname
(
self
):
INET
=
socket
.
AF_INET
STREAM
=
socket
.
SOCK_STREAM
TCP
=
socket
.
IPPROTO_TCP
self
.
assertEqual
(
(
INET
,
STREAM
,
TCP
,
''
,
(
'1.2.3.4'
,
80
)),
base_events
.
_ipaddr_info
(
'1.2.3.4'
,
'http'
,
INET
,
STREAM
,
TCP
))
self
.
assertEqual
(
(
INET
,
STREAM
,
TCP
,
''
,
(
'1.2.3.4'
,
80
)),
base_events
.
_ipaddr_info
(
'1.2.3.4'
,
b
'http'
,
INET
,
STREAM
,
TCP
))
# Raises "service/proto not found".
with
self
.
assertRaises
(
OSError
):
base_events
.
_ipaddr_info
(
'1.2.3.4'
,
'nonsense'
,
INET
,
STREAM
,
TCP
)
with
self
.
assertRaises
(
OSError
):
base_events
.
_ipaddr_info
(
'1.2.3.4'
,
'nonsense'
,
INET
,
STREAM
,
TCP
)
@patch_socket
@patch_socket
def
test_ipaddr_info_no_inet_pton
(
self
,
m_socket
):
def
test_ipaddr_info_no_inet_pton
(
self
,
m_socket
):
del
m_socket
.
inet_pton
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