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
b5b2270a
Kaydet (Commit)
b5b2270a
authored
May 18, 2007
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make test_socket pass. There was an unchecked error when a Unicode
hostname was passed.
üst
1ab83308
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
24 deletions
+24
-24
test_socket.py
Lib/test/test_socket.py
+22
-23
socketmodule.c
Modules/socketmodule.c
+2
-1
No files found.
Lib/test/test_socket.py
Dosyayı görüntüle @
b5b2270a
...
...
@@ -9,7 +9,6 @@ import time
import
thread
,
threading
import
Queue
import
sys
import
array
from
weakref
import
proxy
import
signal
...
...
@@ -394,16 +393,16 @@ class GeneralModuleTests(unittest.TestCase):
from
socket
import
inet_aton
as
f
,
inet_pton
,
AF_INET
g
=
lambda
a
:
inet_pton
(
AF_INET
,
a
)
self
.
assertEquals
(
'
\x00\x00\x00\x00
'
,
f
(
'0.0.0.0'
))
self
.
assertEquals
(
'
\xff\x00\xff\x00
'
,
f
(
'255.0.255.0'
))
self
.
assertEquals
(
'
\xaa\xaa\xaa\xaa
'
,
f
(
'170.170.170.170'
))
self
.
assertEquals
(
'
\x01\x02\x03\x04
'
,
f
(
'1.2.3.4'
))
self
.
assertEquals
(
'
\xff\xff\xff\xff
'
,
f
(
'255.255.255.255'
))
self
.
assertEquals
(
b
'
\x00\x00\x00\x00
'
,
f
(
'0.0.0.0'
))
self
.
assertEquals
(
b
'
\xff\x00\xff\x00
'
,
f
(
'255.0.255.0'
))
self
.
assertEquals
(
b
'
\xaa\xaa\xaa\xaa
'
,
f
(
'170.170.170.170'
))
self
.
assertEquals
(
b
'
\x01\x02\x03\x04
'
,
f
(
'1.2.3.4'
))
self
.
assertEquals
(
b
'
\xff\xff\xff\xff
'
,
f
(
'255.255.255.255'
))
self
.
assertEquals
(
'
\x00\x00\x00\x00
'
,
g
(
'0.0.0.0'
))
self
.
assertEquals
(
'
\xff\x00\xff\x00
'
,
g
(
'255.0.255.0'
))
self
.
assertEquals
(
'
\xaa\xaa\xaa\xaa
'
,
g
(
'170.170.170.170'
))
self
.
assertEquals
(
'
\xff\xff\xff\xff
'
,
g
(
'255.255.255.255'
))
self
.
assertEquals
(
b
'
\x00\x00\x00\x00
'
,
g
(
'0.0.0.0'
))
self
.
assertEquals
(
b
'
\xff\x00\xff\x00
'
,
g
(
'255.0.255.0'
))
self
.
assertEquals
(
b
'
\xaa\xaa\xaa\xaa
'
,
g
(
'170.170.170.170'
))
self
.
assertEquals
(
b
'
\xff\xff\xff\xff
'
,
g
(
'255.255.255.255'
))
def
testIPv6toString
(
self
):
if
not
hasattr
(
socket
,
'inet_pton'
):
...
...
@@ -430,14 +429,14 @@ class GeneralModuleTests(unittest.TestCase):
from
socket
import
inet_ntoa
as
f
,
inet_ntop
,
AF_INET
g
=
lambda
a
:
inet_ntop
(
AF_INET
,
a
)
self
.
assertEquals
(
'1.0.1.0'
,
f
(
'
\x01\x00\x01\x00
'
))
self
.
assertEquals
(
'170.85.170.85'
,
f
(
'
\xaa\x55\xaa\x55
'
))
self
.
assertEquals
(
'255.255.255.255'
,
f
(
'
\xff\xff\xff\xff
'
))
self
.
assertEquals
(
'1.2.3.4'
,
f
(
'
\x01\x02\x03\x04
'
))
self
.
assertEquals
(
'1.0.1.0'
,
f
(
b
'
\x01\x00\x01\x00
'
))
self
.
assertEquals
(
'170.85.170.85'
,
f
(
b
'
\xaa\x55\xaa\x55
'
))
self
.
assertEquals
(
'255.255.255.255'
,
f
(
b
'
\xff\xff\xff\xff
'
))
self
.
assertEquals
(
'1.2.3.4'
,
f
(
b
'
\x01\x02\x03\x04
'
))
self
.
assertEquals
(
'1.0.1.0'
,
g
(
'
\x01\x00\x01\x00
'
))
self
.
assertEquals
(
'170.85.170.85'
,
g
(
'
\xaa\x55\xaa\x55
'
))
self
.
assertEquals
(
'255.255.255.255'
,
g
(
'
\xff\xff\xff\xff
'
))
self
.
assertEquals
(
'1.0.1.0'
,
g
(
b
'
\x01\x00\x01\x00
'
))
self
.
assertEquals
(
'170.85.170.85'
,
g
(
b
'
\xaa\x55\xaa\x55
'
))
self
.
assertEquals
(
'255.255.255.255'
,
g
(
b
'
\xff\xff\xff\xff
'
))
def
testStringToIPv6
(
self
):
if
not
hasattr
(
socket
,
'inet_ntop'
):
...
...
@@ -1053,25 +1052,25 @@ class BufferIOTest(SocketConnectedTest):
SocketConnectedTest
.
__init__
(
self
,
methodName
=
methodName
)
def
testRecvInto
(
self
):
buf
=
array
.
array
(
'c'
,
' '
*
1024
)
buf
=
b
" "
*
1024
nbytes
=
self
.
cli_conn
.
recv_into
(
buf
)
self
.
assertEqual
(
nbytes
,
len
(
MSG
))
msg
=
buf
.
tostring
()[:
len
(
MSG
)]
msg
=
str
(
buf
[:
len
(
MSG
)])
self
.
assertEqual
(
msg
,
MSG
)
def
_testRecvInto
(
self
):
buf
=
b
uffer
(
MSG
)
buf
=
b
ytes
(
MSG
)
self
.
serv_conn
.
send
(
buf
)
def
testRecvFromInto
(
self
):
buf
=
array
.
array
(
'c'
,
' '
*
1024
)
buf
=
b
" "
*
1024
nbytes
,
addr
=
self
.
cli_conn
.
recvfrom_into
(
buf
)
self
.
assertEqual
(
nbytes
,
len
(
MSG
))
msg
=
buf
.
tostring
()[:
len
(
MSG
)]
msg
=
str
(
buf
[:
len
(
MSG
)])
self
.
assertEqual
(
msg
,
MSG
)
def
_testRecvFromInto
(
self
):
buf
=
b
uffer
(
MSG
)
buf
=
b
ytes
(
MSG
)
self
.
serv_conn
.
send
(
buf
)
def
test_main
():
...
...
Modules/socketmodule.c
Dosyayı görüntüle @
b5b2270a
...
...
@@ -3854,7 +3854,8 @@ socket_getaddrinfo(PyObject *self, PyObject *args)
idna
=
PyObject_CallMethod
(
hobj
,
"encode"
,
"s"
,
"idna"
);
if
(
!
idna
)
return
NULL
;
hptr
=
PyString_AsString
(
idna
);
assert
(
PyBytes_Check
(
idna
));
hptr
=
PyBytes_AsString
(
idna
);
}
else
if
(
PyString_Check
(
hobj
))
{
hptr
=
PyString_AsString
(
hobj
);
}
else
{
...
...
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