Skip to content

Commit 023e627

Browse files
committed
Remove use of deprecated array.fromstring method
Using `array.fromstring` generates a `DeprecationWarning` on current versions of Python.
1 parent 65444cf commit 023e627

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Doc/library/socket.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,9 +1411,9 @@ to sockets.
14111411
fds = array.array("i") # Array of ints
14121412
msg, ancdata, flags, addr = sock.recvmsg(msglen, socket.CMSG_LEN(maxfds * fds.itemsize))
14131413
for cmsg_level, cmsg_type, cmsg_data in ancdata:
1414-
if (cmsg_level == socket.SOL_SOCKET and cmsg_type == socket.SCM_RIGHTS):
1414+
if cmsg_level == socket.SOL_SOCKET and cmsg_type == socket.SCM_RIGHTS:
14151415
# Append data, ignoring any truncated integers at the end.
1416-
fds.fromstring(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % fds.itemsize)])
1416+
fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % fds.itemsize)])
14171417
return msg, list(fds)
14181418

14191419
.. availability:: most Unix platforms, possibly others.

Doc/tools/susp-ignored.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ library/readline,,:bind,"python:bind ^I rl_complete"
201201
library/smtplib,,:port,method must support that as well as a regular host:port
202202
library/socket,,::,'5aef:2b::8'
203203
library/socket,,:can,"return (can_id, can_dlc, data[:can_dlc])"
204-
library/socket,,:len,fds.fromstring(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % fds.itemsize)])
204+
library/socket,,:len,fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % fds.itemsize)])
205205
library/sqlite3,,:age,"cur.execute(""select * from people where name_last=:who and age=:age"", {""who"": who, ""age"": age})"
206206
library/sqlite3,,:memory,
207207
library/sqlite3,,:who,"cur.execute(""select * from people where name_last=:who and age=:age"", {""who"": who, ""age"": age})"

0 commit comments

Comments
 (0)