[pypy-commit] pypy py3.5-ssl-revdb: Defer creation of C buffer.
mjacob
pypy.commits at gmail.com
Tue Feb 12 18:52:38 EST 2019
Author: Manuel Jacob <me at manueljacob.de>
Branch: py3.5-ssl-revdb
Changeset: r95990:5c289da45ef2
Date: 2019-02-12 19:58 +0100
http://bitbucket.org/pypy/pypy/changeset/5c289da45ef2/
Log: Defer creation of C buffer.
diff --git a/lib_pypy/_cffi_ssl/_stdssl/__init__.py b/lib_pypy/_cffi_ssl/_stdssl/__init__.py
--- a/lib_pypy/_cffi_ssl/_stdssl/__init__.py
+++ b/lib_pypy/_cffi_ssl/_stdssl/__init__.py
@@ -443,17 +443,17 @@
sock = self.get_socket_or_connection_gone()
if buffer_into is None:
- mem = ffi.new("char[]", length)
if length == 0:
return b""
+ mem = ffi.new("char[]", length)
else:
- mem = ffi.from_buffer(buffer_into)
if length <= 0 or length > len(buffer_into):
length = len(buffer_into)
if length > sys.maxsize:
raise OverflowError("maximum length can't fit in a C 'int'")
if len(buffer_into) == 0:
return 0
+ mem = ffi.from_buffer(buffer_into)
if sock:
timeout = _socket_timeout(sock)
More information about the pypy-commit
mailing list