It can only be used if the second argument is ASCII string. `item_str` is UTF-8 string. The behavior in such case is not defined. _Originally posted by @serhiy-storchaka in https://github.com/python/cpython/pull/27197#discussion_r1239830623_ <!-- gh-linked-prs --> ### Linked PRs * gh-106026 <!-- /gh-linked-prs -->