Being vaguely aware that Python3 had some “interesting” differences compared to Python2, I had decided to not think about Python3 for now, but then one of our dear users piped up to say that even building it was broken! That seemed weird, so I started poking around only to find myself falling Alice-like into a Wonderland where strings were not always strings…
Well, I’ve long been interested in i18n and l10n in all their forms, especially as they apply to Indic languages, so I was somewhat aware of the sorts of issues that Unicode can throw up. Luckily, as a KDE developer I’m used to depending on QString handle all the routine grunt work so it was a bit of a rude awakening to discover that, the C API for Python strings takes many forms:
- Python 2.x has 2 run-time variants with 3 compile-time variants.
- Python 3.2 or less has 3 compile-time variants
- Python 3.3 or greater has 3 run-time variants
- Ubuntu does not yet have 3.3.
- The cmake support in KDE before 4.9.4 cannot find the right libraries.
- The PyKDE4 support for strings was broken-then-fixed.
- Python3 pickles structures differently than Python2.