Trying to fix the str tests in Python 3.12. WIP, will add the description of the underlying principle later. However, case-by-case handling may not be the correct way... @tomo @kirr