From 90f09650e289022e10570702eaf007f44d1cac05 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sat, 16 Jan 2021 11:41:11 -0500 Subject: cleanup from_buffer now that we just use cffi natively (#989) --- src/OpenSSL/SSL.py | 7 +++---- src/OpenSSL/_util.py | 3 --- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/OpenSSL/SSL.py b/src/OpenSSL/SSL.py index e5fea1e..1900b8c 100644 --- a/src/OpenSSL/SSL.py +++ b/src/OpenSSL/SSL.py @@ -12,7 +12,6 @@ from OpenSSL._util import ( UNSPECIFIED as _UNSPECIFIED, exception_from_error_queue as _exception_from_error_queue, ffi as _ffi, - from_buffer as _from_buffer, lib as _lib, make_assert as _make_assert, native as _native, @@ -1641,7 +1640,7 @@ class Connection(object): # Backward compatibility buf = _text_to_bytes_and_warn("buf", buf) - with _from_buffer(buf) as data: + with _ffi.from_buffer(buf) as data: # check len(buf) instead of len(data) for testability if len(buf) > 2147483647: raise ValueError( @@ -1668,7 +1667,7 @@ class Connection(object): """ buf = _text_to_bytes_and_warn("buf", buf) - with _from_buffer(buf) as data: + with _ffi.from_buffer(buf) as data: left_to_send = len(buf) total_sent = 0 @@ -1798,7 +1797,7 @@ class Connection(object): if self._into_ssl is None: raise TypeError("Connection sock was not None") - with _from_buffer(buf) as data: + with _ffi.from_buffer(buf) as data: result = _lib.BIO_write(self._into_ssl, data, len(data)) if result <= 0: self._handle_bio_errors(self._into_ssl, result) diff --git a/src/OpenSSL/_util.py b/src/OpenSSL/_util.py index d04244c..53c0b9e 100644 --- a/src/OpenSSL/_util.py +++ b/src/OpenSSL/_util.py @@ -153,6 +153,3 @@ def text_to_bytes_and_warn(label, obj): ) return obj.encode("utf-8") return obj - - -from_buffer = ffi.from_buffer -- cgit v1.2.1