Author: Philip Jenvey <[email protected]>
Branch: stdlib-2.7.8
Changeset: r73004:7a68266f03ab
Date: 2014-08-23 09:15 -0700
http://bitbucket.org/pypy/pypy/changeset/7a68266f03ab/
Log: merge upstream
diff --git a/pypy/module/_socket/interp_socket.py
b/pypy/module/_socket/interp_socket.py
--- a/pypy/module/_socket/interp_socket.py
+++ b/pypy/module/_socket/interp_socket.py
@@ -446,8 +446,11 @@
def recvfrom_into_w(self, space, w_buffer, nbytes=0, flags=0):
rwbuffer = space.getarg_w('w*', w_buffer)
lgt = rwbuffer.getlength()
- if nbytes == 0 or nbytes > lgt:
+ if nbytes == 0:
nbytes = lgt
+ elif nbytes > lgt:
+ raise OperationError(space.w_ValueError, space.wrap(
+ "nbytes is greater than the length of the buffer"))
try:
readlgt, addr = self.sock.recvfrom_into(rwbuffer, nbytes, flags)
if addr:
diff --git a/pypy/module/_socket/test/test_sock_app.py
b/pypy/module/_socket/test/test_sock_app.py
--- a/pypy/module/_socket/test/test_sock_app.py
+++ b/pypy/module/_socket/test/test_sock_app.py
@@ -716,6 +716,11 @@
msg = buf[:len(MSG)]
assert msg == MSG
+ conn.send(MSG)
+ buf = bytearray(8)
+ exc = raises(ValueError, cli.recvfrom_into, buf, 1024)
+ assert str(exc.value) == "nbytes is greater than the length of the
buffer"
+
def test_family(self):
import socket
cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit