summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2023-01-16 22:00:33 -0500
committerJeff Forcier <jeff@bitprophet.org>2023-01-18 20:19:24 -0500
commit25eb7ca836acf5ea3a56cabfba9d33b08c4a6dd5 (patch)
tree00130133c2a740efa40bfbb41f208e70a61126cf
parenta4157b42306a1af2315818841785569fd7a4d6e4 (diff)
downloadparamiko-25eb7ca836acf5ea3a56cabfba9d33b08c4a6dd5.tar.gz
Handpick remaining-ly relevant changes from #2110
Also make 'em f-strings, which AFAIK should be comparable Closes #2110
-rw-r--r--paramiko/util.py4
-rw-r--r--sites/www/changelog.rst5
2 files changed, 7 insertions, 2 deletions
diff --git a/paramiko/util.py b/paramiko/util.py
index 76941ff4..f1e33a50 100644
--- a/paramiko/util.py
+++ b/paramiko/util.py
@@ -323,7 +323,7 @@ def b(s, encoding="utf8"):
elif isinstance(s, str):
return s.encode(encoding)
else:
- raise TypeError("Expected unicode or bytes, got {!r}".format(s))
+ raise TypeError(f"Expected unicode or bytes, got {type(s)}")
# TODO: clean this up / force callers to assume bytes OR unicode
@@ -334,4 +334,4 @@ def u(s, encoding="utf8"):
elif isinstance(s, str):
return s
else:
- raise TypeError("Expected unicode or bytes, got {!r}".format(s))
+ raise TypeError(f"Expected unicode or bytes, got {type(s)}")
diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst
index 258fe1f8..ed424e29 100644
--- a/sites/www/changelog.rst
+++ b/sites/www/changelog.rst
@@ -2,6 +2,11 @@
Changelog
=========
+- :bug:`2110 major` Remove some unnecessary ``__repr__`` calls when handling
+ bytes-vs-str conversions. This was apparently doing a lot of unintentional
+ data processing, which adds up in some use cases -- such as SFTP transfers,
+ which may now be significantly faster. Kudos to Shuhua Zhong for catch &
+ patch.
- :bug:`2165 major` Streamline some redundant (and costly) byte conversion
calls in the packetizer and the core SFTP module. This should lead to some
SFTP speedups at the very least. Thanks to Alex Gaynor for the patch.