summaryrefslogtreecommitdiff
path: root/src/OpenSSL/SSL.py
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2018-03-21 14:49:42 +0100
committerAlex Gaynor <alex.gaynor@gmail.com>2018-03-21 09:49:42 -0400
commit1ae7cb68cd285fe822c84d8e3198aff9716cf4e8 (patch)
tree8b280f24b25c1f1d2b9e0478655d3fddbaf1468e /src/OpenSSL/SSL.py
parent993c4e4afc4274019bdb835b64191afeed6c13b7 (diff)
downloadpyopenssl-1ae7cb68cd285fe822c84d8e3198aff9716cf4e8.tar.gz
Raise minimum cryptography version to 2.2.1, drop python 2.6 (#742)
Diffstat (limited to 'src/OpenSSL/SSL.py')
-rw-r--r--src/OpenSSL/SSL.py18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/OpenSSL/SSL.py b/src/OpenSSL/SSL.py
index b5dd442..f3c9db0 100644
--- a/src/OpenSSL/SSL.py
+++ b/src/OpenSSL/SSL.py
@@ -113,12 +113,6 @@ __all__ = [
]
try:
- _memoryview = memoryview
-except NameError:
- class _memoryview(object):
- pass
-
-try:
_buffer = buffer
except NameError:
class _buffer(object):
@@ -1702,7 +1696,7 @@ class Connection(object):
# Backward compatibility
buf = _text_to_bytes_and_warn("buf", buf)
- if isinstance(buf, _memoryview):
+ if isinstance(buf, memoryview):
buf = buf.tobytes()
if isinstance(buf, _buffer):
buf = str(buf)
@@ -1729,7 +1723,7 @@ class Connection(object):
"""
buf = _text_to_bytes_and_warn("buf", buf)
- if isinstance(buf, _memoryview):
+ if isinstance(buf, memoryview):
buf = buf.tobytes()
if isinstance(buf, _buffer):
buf = str(buf)
@@ -1802,12 +1796,8 @@ class Connection(object):
# This strange line is all to avoid a memory copy. The buffer protocol
# should allow us to assign a CFFI buffer to the LHS of this line, but
# on CPython 3.3+ that segfaults. As a workaround, we can temporarily
- # wrap it in a memoryview, except on Python 2.6 which doesn't have a
- # memoryview type.
- try:
- buffer[:result] = memoryview(_ffi.buffer(buf, result))
- except NameError:
- buffer[:result] = _ffi.buffer(buf, result)
+ # wrap it in a memoryview.
+ buffer[:result] = memoryview(_ffi.buffer(buf, result))
return result