Skip to content

Commit 3fd309a

Browse files
committed
Enhance super_len to count encoded bytes for str
This fixes issue #6586
1 parent f670704 commit 3fd309a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/requests/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ def super_len(o):
134134
total_length = None
135135
current_position = 0
136136

137+
if isinstance(o, str):
138+
o = o.encode("utf-8")
139+
137140
if hasattr(o, "__len__"):
138141
total_length = len(o)
139142

0 commit comments

Comments
 (0)