Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb10c71d

Browse files
committed
Backed out changeset c0f2b038fc12
1 parentc7c333d commitb10c71d

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

‎Lib/test/test_socket.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4451,7 +4451,7 @@ class TestLinuxAbstractNamespace(unittest.TestCase):
44514451
UNIX_PATH_MAX=108
44524452

44534453
deftestLinuxAbstractNamespace(self):
4454-
address="\x00python-test-hello\x00\xff"
4454+
address=b"\x00python-test-hello\x00\xff"
44554455
withsocket.socket(socket.AF_UNIX,socket.SOCK_STREAM)ass1:
44564456
s1.bind(address)
44574457
s1.listen(1)
@@ -4462,7 +4462,7 @@ def testLinuxAbstractNamespace(self):
44624462
self.assertEqual(s2.getpeername(),address)
44634463

44644464
deftestMaxName(self):
4465-
address="\x00"+"h"* (self.UNIX_PATH_MAX-1)
4465+
address=b"\x00"+b"h"* (self.UNIX_PATH_MAX-1)
44664466
withsocket.socket(socket.AF_UNIX,socket.SOCK_STREAM)ass:
44674467
s.bind(address)
44684468
self.assertEqual(s.getsockname(),address)
@@ -4472,12 +4472,12 @@ def testNameOverflow(self):
44724472
withsocket.socket(socket.AF_UNIX,socket.SOCK_STREAM)ass:
44734473
self.assertRaises(OSError,s.bind,address)
44744474

4475-
deftestBytesName(self):
4476-
# Check that an abstract name can be passed asbytes.
4475+
deftestStrName(self):
4476+
# Check that an abstract name can be passed asa string.
44774477
s=socket.socket(socket.AF_UNIX,socket.SOCK_STREAM)
44784478
try:
4479-
s.bind(b"\x00python\x00test\x00")
4480-
self.assertEqual(s.getsockname(),"\x00python\x00test\x00")
4479+
s.bind("\x00python\x00test\x00")
4480+
self.assertEqual(s.getsockname(),b"\x00python\x00test\x00")
44814481
finally:
44824482
s.close()
44834483

‎Misc/NEWS‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,6 @@ Core and Builtins
9999
Library
100100
-------
101101

102-
- Issue #17683: socket module: return AF_UNIX addresses in Linux abstract
103-
namespace as string.
104-
105102
- Issue #17914: Add os.cpu_count(). Patch by Yogesh Chaudhari, based on an
106103
initial patch by Trent Nelson.
107104

‎Modules/socketmodule.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ makesockaddr(SOCKET_T sockfd, struct sockaddr *addr, size_t addrlen, int proto)
10181018
#ifdeflinux
10191019
if (a->sun_path[0]==0) {/* Linux abstract namespace */
10201020
addrlen-= offsetof(structsockaddr_un,sun_path);
1021-
returnPyUnicode_DecodeFSDefaultAndSize(a->sun_path,addrlen);
1021+
returnPyBytes_FromStringAndSize(a->sun_path,addrlen);
10221022
}
10231023
else
10241024
#endif/* linux */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp