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
919ae531
Commit
919ae531
authored
Aug 22, 2011
by
Nadeem Vawda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix deprecation warnings in test_socket.
parent
5e4c34c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
Lib/test/test_socket.py
Lib/test/test_socket.py
+14
-14
No files found.
Lib/test/test_socket.py
View file @
919ae531
...
...
@@ -1884,7 +1884,7 @@ class RecvmsgIntoTests(RecvmsgIntoMixin, RecvmsgGenericTests):
buf
=
array
.
array
(
"B"
,
[
0
]
*
len
(
MSG
))
nbytes
,
ancdata
,
flags
,
addr
=
self
.
serv_sock
.
recvmsg_into
([
buf
])
self
.
assertEqual
(
nbytes
,
len
(
MSG
))
self
.
assertEqual
(
buf
.
to
string
(),
MSG
)
self
.
assertEqual
(
buf
.
to
bytes
(),
MSG
)
self
.
checkRecvmsgAddress
(
addr
,
self
.
cli_addr
)
self
.
assertEqual
(
ancdata
,
[])
self
.
checkFlags
(
flags
,
eor
=
True
)
...
...
@@ -2002,7 +2002,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
if
(
cmsg_level
==
socket
.
SOL_SOCKET
and
cmsg_type
==
socket
.
SCM_RIGHTS
):
fds
=
array
.
array
(
"i"
)
fds
.
from
string
(
cmsg_data
[:
fds
.
from
bytes
(
cmsg_data
[:
len
(
cmsg_data
)
-
(
len
(
cmsg_data
)
%
fds
.
itemsize
)])
for
fd
in
fds
:
os
.
close
(
fd
)
...
...
@@ -2039,7 +2039,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
self
.
assertEqual
(
cmsg_type
,
socket
.
SCM_RIGHTS
)
self
.
assertIsInstance
(
cmsg_data
,
bytes
)
self
.
assertEqual
(
len
(
cmsg_data
)
%
SIZEOF_INT
,
0
)
fds
.
from
string
(
cmsg_data
)
fds
.
from
bytes
(
cmsg_data
)
self
.
assertEqual
(
len
(
fds
),
numfds
)
self
.
checkFDs
(
fds
)
...
...
@@ -2055,7 +2055,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
[
MSG
],
[(
socket
.
SOL_SOCKET
,
socket
.
SCM_RIGHTS
,
array
.
array
(
"i"
,
self
.
newFDs
(
1
)).
to
string
())]),
array
.
array
(
"i"
,
self
.
newFDs
(
1
)).
to
bytes
())]),
len
(
MSG
))
def
testMultipleFDPass
(
self
):
...
...
@@ -2173,7 +2173,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
MSG
,
[(
socket
.
SOL_SOCKET
,
socket
.
SCM_RIGHTS
,
array
.
array
(
"i"
,
[
self
.
badfd
]).
to
string
()[:
-
1
])])
array
.
array
(
"i"
,
[
self
.
badfd
]).
to
bytes
()[:
-
1
])])
@
requireAttrs
(
socket
,
"CMSG_SPACE"
)
def
testFDPassPartialIntInMiddle
(
self
):
...
...
@@ -2189,7 +2189,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
for
cmsg_level
,
cmsg_type
,
cmsg_data
in
ancdata
:
self
.
assertEqual
(
cmsg_level
,
socket
.
SOL_SOCKET
)
self
.
assertEqual
(
cmsg_type
,
socket
.
SCM_RIGHTS
)
fds
.
from
string
(
cmsg_data
[:
fds
.
from
bytes
(
cmsg_data
[:
len
(
cmsg_data
)
-
(
len
(
cmsg_data
)
%
fds
.
itemsize
)])
self
.
assertLessEqual
(
len
(
fds
),
2
)
self
.
checkFDs
(
fds
)
...
...
@@ -2201,7 +2201,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
MSG
,
[(
socket
.
SOL_SOCKET
,
socket
.
SCM_RIGHTS
,
array
.
array
(
"i"
,
[
fd0
,
self
.
badfd
]).
to
string
()[:
-
1
]),
array
.
array
(
"i"
,
[
fd0
,
self
.
badfd
]).
to
bytes
()[:
-
1
]),
(
socket
.
SOL_SOCKET
,
socket
.
SCM_RIGHTS
,
array
.
array
(
"i"
,
[
fd1
]))])
...
...
@@ -2285,7 +2285,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase):
self
.
assertGreaterEqual
(
len
(
cmsg_data
),
mindata
)
self
.
assertLessEqual
(
len
(
cmsg_data
),
maxdata
)
fds
=
array
.
array
(
"i"
)
fds
.
from
string
(
cmsg_data
[:
fds
.
from
bytes
(
cmsg_data
[:
len
(
cmsg_data
)
-
(
len
(
cmsg_data
)
%
fds
.
itemsize
)])
self
.
checkFDs
(
fds
)
...
...
@@ -2367,7 +2367,7 @@ class RFC3542AncillaryTest(SendrecvmsgServerTimeoutBase):
self
.
assertIsInstance
(
cmsg_data
,
bytes
)
self
.
assertEqual
(
len
(
cmsg_data
),
SIZEOF_INT
)
a
=
array
.
array
(
"i"
)
a
.
from
string
(
cmsg_data
)
a
.
from
bytes
(
cmsg_data
)
self
.
assertGreaterEqual
(
a
[
0
],
0
)
self
.
assertLessEqual
(
a
[
0
],
maxhop
)
...
...
@@ -2440,14 +2440,14 @@ class RFC3542AncillaryTest(SendrecvmsgServerTimeoutBase):
tcdata
=
ancmap
[(
socket
.
IPPROTO_IPV6
,
socket
.
IPV6_TCLASS
)]
self
.
assertEqual
(
len
(
tcdata
),
SIZEOF_INT
)
a
=
array
.
array
(
"i"
)
a
.
from
string
(
tcdata
)
a
.
from
bytes
(
tcdata
)
self
.
assertGreaterEqual
(
a
[
0
],
0
)
self
.
assertLessEqual
(
a
[
0
],
255
)
hldata
=
ancmap
[(
socket
.
IPPROTO_IPV6
,
socket
.
IPV6_HOPLIMIT
)]
self
.
assertEqual
(
len
(
hldata
),
SIZEOF_INT
)
a
=
array
.
array
(
"i"
)
a
.
from
string
(
hldata
)
a
.
from
bytes
(
hldata
)
self
.
assertGreaterEqual
(
a
[
0
],
0
)
self
.
assertLessEqual
(
a
[
0
],
maxhop
)
...
...
@@ -2512,7 +2512,7 @@ class RFC3542AncillaryTest(SendrecvmsgServerTimeoutBase):
nbytes
=
self
.
sendmsgToServer
(
[
MSG
],
[(
socket
.
IPPROTO_IPV6
,
socket
.
IPV6_TCLASS
,
array
.
array
(
"i"
,
[
self
.
traffic_class
]).
to
string
()
+
b"
\
x00
"
),
array
.
array
(
"i"
,
[
self
.
traffic_class
]).
to
bytes
()
+
b"
\
x00
"
),
(
socket
.
IPPROTO_IPV6
,
socket
.
IPV6_HOPLIMIT
,
array
.
array
(
"i"
,
[
self
.
hop_limit
]))])
except
socket
.
error
as
e
:
...
...
@@ -2658,7 +2658,7 @@ class RFC3542AncillaryTest(SendrecvmsgServerTimeoutBase):
self
.
assertIn
(
cmsg_type
,
{
socket
.
IPV6_TCLASS
,
socket
.
IPV6_HOPLIMIT
})
self
.
assertEqual
(
len
(
cmsg_data
),
SIZEOF_INT
)
a
=
array
.
array
(
"i"
)
a
.
from
string
(
cmsg_data
)
a
.
from
bytes
(
cmsg_data
)
self
.
assertGreaterEqual
(
a
[
0
],
0
)
self
.
assertLessEqual
(
a
[
0
],
255
)
...
...
@@ -2732,7 +2732,7 @@ class RFC3542AncillaryTest(SendrecvmsgServerTimeoutBase):
cmsg_types
.
remove
(
cmsg_type
)
self
.
assertEqual
(
len
(
cmsg_data
),
SIZEOF_INT
)
a
=
array
.
array
(
"i"
)
a
.
from
string
(
cmsg_data
)
a
.
from
bytes
(
cmsg_data
)
self
.
assertGreaterEqual
(
a
[
0
],
0
)
self
.
assertLessEqual
(
a
[
0
],
255
)
...
...
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