This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author JelleZijlstra
Recipients JelleZijlstra, barry, dlenski, iritkatriel, py.user, r.david.murray
Date 2022-01-21.01:48:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This behavior is definitely unfortunate, but by now it's also been baked into more than a decade of Python 3 releases, so backward compatibility constraints make it difficult to fix.

How can we be sure this change won't break users' code?

For reference, here are a few uses of the function I found in major open-source packages:
- - this assumes it only ever hits the (bytes, encoding) case.
- - this assumes it only gets (str, None) or (bytes, encoding) pairs, which seems unsafe. But if it currently sees (str, None) and would see (bytes, None) with this change, it would break.

An alternative solution could be a new function with a sane return type.

Even if we decide to not change anything, we should document the surprising return type at
Date User Action Args
2022-01-21 01:48:16JelleZijlstrasetrecipients: + JelleZijlstra, barry, r.david.murray, py.user, dlenski, iritkatriel
2022-01-21 01:48:16JelleZijlstrasetmessageid: <>
2022-01-21 01:48:16JelleZijlstralinkissue22833 messages
2022-01-21 01:48:16JelleZijlstracreate