summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--paramiko/agent.py4
-rw-r--r--paramiko/client.py4
-rw-r--r--paramiko/packet.py11
-rw-r--r--paramiko/transport.py3
-rw-r--r--paramiko/util.py11
-rw-r--r--sites/www/changelog.rst11
-rw-r--r--tests/test_util.py34
7 files changed, 16 insertions, 62 deletions
diff --git a/paramiko/agent.py b/paramiko/agent.py
index f2d57ea5..c1a07390 100644
--- a/paramiko/agent.py
+++ b/paramiko/agent.py
@@ -34,7 +34,7 @@ from paramiko.common import io_sleep, byte_chr
from paramiko.ssh_exception import SSHException, AuthenticationException
from paramiko.message import Message
from paramiko.pkey import PKey
-from paramiko.util import retry_on_signal, asbytes
+from paramiko.util import asbytes
cSSH2_AGENTC_REQUEST_IDENTITIES = byte_chr(11)
SSH2_AGENT_IDENTITIES_ANSWER = 12
@@ -213,7 +213,7 @@ def get_agent_connection():
if ("SSH_AUTH_SOCK" in os.environ) and (sys.platform != "win32"):
conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try:
- retry_on_signal(lambda: conn.connect(os.environ["SSH_AUTH_SOCK"]))
+ conn.connect(os.environ["SSH_AUTH_SOCK"])
return conn
except:
# probably a dangling env var: the ssh agent is gone
diff --git a/paramiko/client.py b/paramiko/client.py
index 2dd25e91..5667d7e7 100644
--- a/paramiko/client.py
+++ b/paramiko/client.py
@@ -42,7 +42,7 @@ from paramiko.ssh_exception import (
NoValidConnectionsError,
)
from paramiko.transport import Transport
-from paramiko.util import retry_on_signal, ClosingContextManager
+from paramiko.util import ClosingContextManager
class SSHClient(ClosingContextManager):
@@ -354,7 +354,7 @@ class SSHClient(ClosingContextManager):
sock.settimeout(timeout)
except:
pass
- retry_on_signal(lambda: sock.connect(addr))
+ sock.connect(addr)
# Break out of the loop on success
break
except socket.error as e:
diff --git a/paramiko/packet.py b/paramiko/packet.py
index 9125301e..211bf946 100644
--- a/paramiko/packet.py
+++ b/paramiko/packet.py
@@ -312,9 +312,6 @@ class Packetizer:
arg = first_arg(e)
if arg == errno.EAGAIN:
got_timeout = True
- elif arg == errno.EINTR:
- # syscall interrupted; try again
- pass
elif self.__closed:
raise EOFError()
else:
@@ -340,9 +337,6 @@ class Packetizer:
arg = first_arg(e)
if arg == errno.EAGAIN:
retry_write = True
- elif arg == errno.EINTR:
- # syscall interrupted; try again
- retry_write = True
else:
n = -1
except ProxyCommandFailure:
@@ -610,11 +604,6 @@ class Packetizer:
break
except socket.timeout:
pass
- except EnvironmentError as e:
- if first_arg(e) == errno.EINTR:
- pass
- else:
- raise
if self.__closed:
raise EOFError()
now = time.time()
diff --git a/paramiko/transport.py b/paramiko/transport.py
index 6c14218c..2b6acd6e 100644
--- a/paramiko/transport.py
+++ b/paramiko/transport.py
@@ -112,7 +112,6 @@ from paramiko.ssh_exception import (
ProxyCommandFailure,
)
from paramiko.util import (
- retry_on_signal,
ClosingContextManager,
clamp_value,
b,
@@ -436,7 +435,7 @@ class Transport(threading.Thread, ClosingContextManager):
# addr = sockaddr
sock = socket.socket(af, socket.SOCK_STREAM)
try:
- retry_on_signal(lambda: sock.connect((hostname, port)))
+ sock.connect((hostname, port))
except socket.error as e:
reason = str(e)
else:
diff --git a/paramiko/util.py b/paramiko/util.py
index f6125eb1..76941ff4 100644
--- a/paramiko/util.py
+++ b/paramiko/util.py
@@ -21,7 +21,6 @@ Useful functions used by the rest of paramiko.
"""
-import errno
import sys
import struct
import traceback
@@ -273,16 +272,6 @@ def get_logger(name):
return logger
-def retry_on_signal(function):
- """Retries function until it doesn't raise an EINTR error"""
- while True:
- try:
- return function()
- except EnvironmentError as e:
- if e.errno != errno.EINTR:
- raise
-
-
def constant_time_bytes_eq(a, b):
if len(a) != len(b):
return False
diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst
index 6df416a0..162d01bf 100644
--- a/sites/www/changelog.rst
+++ b/sites/www/changelog.rst
@@ -2,6 +2,17 @@
Changelog
=========
+- :support:`-` ``paramiko.util.retry_on_signal`` (and any internal uses of
+ same, and also any internal retries of ``EINTR`` on eg socket operations) has
+ been removed. As of Python 3.5, per `PEP 475
+ <https://peps.python.org/pep-0475/>`_, this functionality (and retrying
+ ``EINTR`` generally) is now part of the standard library.
+
+ .. warning::
+ This change is backwards incompatible if you were explicitly
+ importing/using this particular function. The observable behavior otherwise
+ should not be changing.
+
- :support:`732` (also re: :issue:`630`) `~paramiko.config.SSHConfig` used to
straight-up delete the ``proxycommand`` key from config lookup results when
the source config said ``ProxyCommand none``. This has been altered to
diff --git a/tests/test_util.py b/tests/test_util.py
index 1c276f8d..ec03846b 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -21,7 +21,6 @@ Some unit tests for utility functions.
"""
from binascii import hexlify
-import errno
import os
from hashlib import sha1
import unittest
@@ -108,39 +107,6 @@ class UtilTest(unittest.TestCase):
finally:
os.unlink("hostfile.temp")
- def test_eintr_retry(self):
- assert "foo" == paramiko.util.retry_on_signal(lambda: "foo")
-
- # Variables that are set by raises_intr
- intr_errors_remaining = [3]
- call_count = [0]
-
- def raises_intr():
- call_count[0] += 1
- if intr_errors_remaining[0] > 0:
- intr_errors_remaining[0] -= 1
- raise IOError(errno.EINTR, "file", "interrupted system call")
-
- self.assertTrue(paramiko.util.retry_on_signal(raises_intr) is None)
- assert 0 == intr_errors_remaining[0]
- assert 4 == call_count[0]
-
- def raises_ioerror_not_eintr():
- raise IOError(errno.ENOENT, "file", "file not found")
-
- self.assertRaises(
- IOError,
- lambda: paramiko.util.retry_on_signal(raises_ioerror_not_eintr),
- )
-
- def raises_other_exception():
- raise AssertionError("foo")
-
- self.assertRaises(
- AssertionError,
- lambda: paramiko.util.retry_on_signal(raises_other_exception),
- )
-
def test_clamp_value(self):
assert 32768 == paramiko.util.clamp_value(32767, 32768, 32769)
assert 32767 == paramiko.util.clamp_value(32767, 32765, 32769)