[issue43309] str.replace() TypeError exception message backward

2021-02-23 Thread bland328
bland328 added the comment: Dumb misunderstanding on my part--didn't realize replace() would actually work on a bytes-type object, so *I* had it backwards. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker

[issue43309] str.replace() TypeError exception message backward

2021-02-23 Thread bland328
New submission from bland328 : Attempting to replace a character in a bytes string literal results in an exception saying that "a bytes-like object is required, not 'str'", when (unless I'm missing something) it should say the opposite. To repro: >>> x=b'abc' >>> x.replace('a','z') Traceback