Skip to content

Commit 808d571

Browse files
committed
Fix using recv_into with buffers without internal byte array
1 parent 9059324 commit 808d571

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/socket/SocketBuiltins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ Object recvInto(VirtualFrame frame, PSocket socket, Object bufferObj, int recvle
680680
() -> posixLib.recv(getPosixSupport(), socket.getFd(), bytes, 0, len, flags),
681681
false, false);
682682
if (!directWrite) {
683-
bufferLib.readIntoByteArray(buffer, 0, bytes, 0, outlen);
683+
bufferLib.writeFromByteArray(buffer, 0, bytes, 0, outlen);
684684
}
685685
return outlen;
686686
} catch (PosixException e) {
@@ -743,7 +743,7 @@ Object recvFromInto(VirtualFrame frame, PSocket socket, Object bufferObj, int re
743743
() -> posixLib.recvfrom(getPosixSupport(), socket.getFd(), bytes, 0, bytes.length, flags),
744744
false, false);
745745
if (!directWrite) {
746-
bufferLib.readIntoByteArray(buffer, 0, bytes, 0, result.readBytes);
746+
bufferLib.writeFromByteArray(buffer, 0, bytes, 0, result.readBytes);
747747
}
748748
return factory().createTuple(new Object[]{result.readBytes, makeSockAddrNode.execute(frame, result.sockAddr)});
749749
} catch (PosixException e) {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/ssl/SSLSocketBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Object readInto(VirtualFrame frame, PSSLSocket self, int len, Object bufferObj,
135135
PythonUtils.flipBuffer(output);
136136
int readBytes = PythonUtils.getBufferRemaining(output);
137137
if (!directWrite) {
138-
bufferLib.readIntoByteArray(buffer, 0, bytes, 0, readBytes);
138+
bufferLib.writeFromByteArray(buffer, 0, bytes, 0, readBytes);
139139
}
140140
return readBytes;
141141
} finally {

0 commit comments

Comments
 (0)