You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why do you say it's incorrect? Because there's only a decode call? I can reproduce a UnicodeEncodeError with a decode:
Traceback (most recent call last):
File "/ATO/code", line 1, in <module>
b''.decode('\udce2')
UnicodeEncodeError: 'utf-8' codec can't encode character '\udce2' in position 0: surrogates not allowed
Got that from the commit that added the UnicodeEncodeError catch. And the issue also showed a UnicodeEncodeError.
I tried your change anyway, and it didn't make a test fail. Maybe a test should be added for that? (Maybe one was added but doesn't actually test it?)
Activity
pochmann3 commentedon Mar 13, 2024
Why do you say it's incorrect? Because there's only a
decodecall? I can reproduce a UnicodeEncodeError with adecode:Got that from the commit that added the UnicodeEncodeError catch. And the issue also showed a UnicodeEncodeError.
I tried your change anyway, and it didn't make a test fail. Maybe a test should be added for that? (Maybe one was added but doesn't actually test it?)
naga0001 commentedon Mar 13, 2024
Sorry, I thought it was UnicodeDecodeError because it is simply decode.
Was UnicodeDecodeError exception handling unnecessary for this process?
pochmann3 commentedon Mar 14, 2024
I think the
surrogateescapeerror handler indeed makes other exception handling unnecessary, but I'm no expert. You could also try asking on Discourse.picnixz commentedon Jul 20, 2025
Closing in favor of #132794 as the latter has a better description.