diff options
author | Benjamin Peterson <benjamin@python.org> | 2020-05-22 11:32:07 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-22 11:32:07 -0500 |
commit | 2dca7a75eef7c931abbbb6b9a87b1659db5ae6c8 (patch) | |
tree | f8fb177776b69386bb65388a7b80d265fd851bfa | |
parent | e41098f271dc96d6c411172bb11bbe5816f78710 (diff) | |
download | pyopenssl-git-2dca7a75eef7c931abbbb6b9a87b1659db5ae6c8.tar.gz |
Remove deprecated tsafe module. (#913)
-rw-r--r-- | CHANGELOG.rst | 1 | ||||
-rw-r--r-- | src/OpenSSL/tsafe.py | 31 | ||||
-rw-r--r-- | tests/test_tsafe.py | 23 |
3 files changed, 1 insertions, 54 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f72d0a6..622369d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -11,6 +11,7 @@ The third digit is only for regressions. Backward-incompatible changes: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +- Remove deprecated ``OpenSSL.tsafe`` module. - Drop support for Python 3.4 - Drop support for OpenSSL 1.0.1 diff --git a/src/OpenSSL/tsafe.py b/src/OpenSSL/tsafe.py deleted file mode 100644 index f1c6f67..0000000 --- a/src/OpenSSL/tsafe.py +++ /dev/null @@ -1,31 +0,0 @@ -import warnings -from threading import RLock as _RLock - -from OpenSSL import SSL as _ssl - - -warnings.warn( - "OpenSSL.tsafe is deprecated and will be removed", - DeprecationWarning, stacklevel=3 -) - - -class Connection: - def __init__(self, *args): - self._ssl_conn = _ssl.Connection(*args) - self._lock = _RLock() - - for f in ('get_context', 'pending', 'send', 'write', 'recv', 'read', - 'renegotiate', 'bind', 'listen', 'connect', 'accept', - 'setblocking', 'fileno', 'shutdown', 'close', 'get_cipher_list', - 'getpeername', 'getsockname', 'getsockopt', 'setsockopt', - 'makefile', 'get_app_data', 'set_app_data', 'state_string', - 'sock_shutdown', 'get_peer_certificate', 'get_peer_cert_chain', - 'want_read', 'want_write', 'set_connect_state', - 'set_accept_state', 'connect_ex', 'sendall'): - exec("""def %s(self, *args): - self._lock.acquire() - try: - return self._ssl_conn.%s(*args) - finally: - self._lock.release()\n""" % (f, f)) diff --git a/tests/test_tsafe.py b/tests/test_tsafe.py deleted file mode 100644 index 8ffe35a..0000000 --- a/tests/test_tsafe.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (C) Jean-Paul Calderone -# See LICENSE for details. - -""" -Unit tests for `OpenSSL.tsafe`. -""" - -from OpenSSL.SSL import TLSv1_METHOD, Context -from OpenSSL.tsafe import Connection - - -class TestConnection(object): - """ - Tests for `OpenSSL.tsafe.Connection`. - """ - def test_instantiation(self): - """ - `OpenSSL.tsafe.Connection` can be instantiated. - """ - # The following line should not throw an error. This isn't an ideal - # test. It would be great to refactor the other Connection tests so - # they could automatically be applied to this class too. - Connection(Context(TLSv1_METHOD), None) |