summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.