mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-136702: Deprecate passing non-ascii *encoding* (str) to encodings.normalize_encoding (#140030)
Closes #136702
This commit is contained in:
parent
7ae440f262
commit
5ba0a1aa1f
8 changed files with 42 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue