From 6091e11cae1e2ca43709266d0e3ba84ded12ddfc Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 23 May 2017 20:31:03 -0700 Subject: Bump the minimum PyPy/cffi version and simplify as a result (#3585) * Bump the minimum PyPy/cffi version and simplify as a result * unused imports * grumble, fix --- src/cryptography/hazmat/primitives/ciphers/base.py | 34 +++++----------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/cryptography/hazmat/primitives/ciphers/base.py b/src/cryptography/hazmat/primitives/ciphers/base.py index 826e23ef..f8570414 100644 --- a/src/cryptography/hazmat/primitives/ciphers/base.py +++ b/src/cryptography/hazmat/primitives/ciphers/base.py @@ -6,8 +6,6 @@ from __future__ import absolute_import, division, print_function import abc -import cffi - import six from cryptography import utils @@ -150,19 +148,10 @@ class _CipherContext(object): raise AlreadyFinalized("Context was already finalized.") return self._ctx.update(data) - # cffi 1.7 supports from_buffer on bytearray, which is required. We can - # remove this check in the future when we raise our minimum PyPy version. - if cffi.__version_info__ >= (1, 7): - def update_into(self, data, buf): - if self._ctx is None: - raise AlreadyFinalized("Context was already finalized.") - return self._ctx.update_into(data, buf) - else: - def update_into(self, data, buf): - raise NotImplementedError( - "update_into requires cffi 1.7+. To use this method please " - "update cffi." - ) + def update_into(self, data, buf): + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + return self._ctx.update_into(data, buf) def finalize(self): if self._ctx is None: @@ -199,18 +188,9 @@ class _AEADCipherContext(object): self._check_limit(len(data)) return self._ctx.update(data) - # cffi 1.7 supports from_buffer on bytearray, which is required. We can - # remove this check in the future when we raise our minimum PyPy version. - if cffi.__version_info__ >= (1, 7): - def update_into(self, data, buf): - self._check_limit(len(data)) - return self._ctx.update_into(data, buf) - else: - def update_into(self, data, buf): - raise NotImplementedError( - "update_into requires cffi 1.7+. To use this method please " - "update cffi." - ) + def update_into(self, data, buf): + self._check_limit(len(data)) + return self._ctx.update_into(data, buf) def finalize(self): if self._ctx is None: -- cgit v1.2.3