diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2023-04-14 12:19:40 -0400 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2023-05-05 12:26:52 -0400 |
commit | 80556bdc9944df60eb0a06c3985bcf2dae1376e2 (patch) | |
tree | 1e922cea681f9305d58a4c59ae8663dd55e13730 | |
parent | 9a7ba15841f8986849a8694e9d1d7a7cd0cd6fd1 (diff) |
Fix now-broken-on-py3 AgentKey.__str__, by deleting it
-rw-r--r-- | paramiko/agent.py | 3 | ||||
-rw-r--r-- | sites/www/changelog.rst | 3 | ||||
-rw-r--r-- | tests/test_agent.py | 7 |
3 files changed, 10 insertions, 3 deletions
diff --git a/paramiko/agent.py b/paramiko/agent.py index 30ec1590..8aa8d9a3 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -428,9 +428,6 @@ class AgentKey(PKey): def asbytes(self): return self.blob - def __str__(self): - return self.asbytes() - def get_name(self): return self.name diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst index 0b2022ca..d93c0494 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -2,6 +2,9 @@ Changelog ========= +- :bug:`-` `~paramiko.agent.AgentKey` had a dangling Python 3 incompatible + ``__str__`` method returning bytes. This method has been removed, allowing + the superclass' (`~paramiko.pkey.PKey`) method to run instead. - :release:`3.1.0 <2023-03-10>` - :feature:`2013` (solving :issue:`2009`, plus others) Add an explicit ``channel_timeout`` keyword argument to `paramiko.client.SSHClient.connect`, diff --git a/tests/test_agent.py b/tests/test_agent.py index 01602d0e..a00011bf 100644 --- a/tests/test_agent.py +++ b/tests/test_agent.py @@ -48,3 +48,10 @@ class AgentTests(unittest.TestCase): kwargs=dict(algorithm="rsa-sha2-512"), expectation=SSH_AGENT_RSA_SHA2_512, ) + + def test_agent_key_str_kinda_fixed(self): + # Tests for a missed spot in Python 3 upgrades: AgentKey.__str__ was + # returning bytes, as if under Python 2. When bug present, this + # explodes with "__str__ returned non-string". + key = AgentKey(ChaosAgent(), b("secret!!!")) + assert str(key) == repr(key) |