gh-136702: Deprecate passing non-ascii *encoding* (str) to encodings.normalize_encoding (#140030)

Closes #136702
This commit is contained in:
Stan Ulbrych 2025-11-09 12:37:34 +00:00 committed by GitHub
parent 7ae440f262
commit 5ba0a1aa1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 42 additions and 6 deletions

View file

@ -796,6 +796,10 @@ def params(self):
value = urllib.parse.unquote(value, encoding='latin-1')
else:
try:
# Explicitly look up the codec for warning generation, see gh-140030
# Can be removed in 3.17
import codecs
codecs.lookup(charset)
value = value.decode(charset, 'surrogateescape')
except (LookupError, UnicodeEncodeError):
# XXX: there should really be a custom defect for