
On Wed, Dec 21, 2022 at 9:35 AM Chris Angelico <rosuav@gmail.com> wrote:
From the look of things, PyUnicode_Join (the internal function that handles str.join()) uses a lot of "reaching into the data structure" operations for efficiency. It uses PyUnicode_Check (aka "isinstance(x, str)") rather than PyUnicode_CheckExact (aka "type(x) is str") and then proceeds to cast the pointer and directly inspect its members.
As such, I don't think UserString can ever truly be a str,
I had figured subclasses of str wouldn’t be full players in the C code — but join() us pretty fundamental:-( -CHB -- Christopher Barker, PhD (Chris) Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython