Skip to content
Myr

Enhance `super_len` to count encoded bytes for str

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This fixes issue #6586

authored by Bruce Adams · committed by Bruce Adams · parent f670704 · Browse files · 1 file+3 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−0 removed

  • other:+3 added−0 removed

1 file+3 added−0 removed

modified:src/requests/utils.py+3 added
132 unmodified lines
133def super_len(o):134 total_length = None135 current_position = 0136137 if isinstance(o, str):138 o = o.encode("utf-8")139140 if hasattr(o, "__len__"):141 total_length = len(o)142143 elif hasattr(o, "len"):
951 unmodified lines