phihag/buildout.python — pull request #1 by phihag (2013-05-14 17:16:55+00:00)
Title: Enable wide unicode support in Python<3.3

The python by generated by buildout.python does not support arbitrary characters because it compiles the so-called "narrow" (which should really be called "buggy") version of Python. Apart from breaking Python scripts themselves, narrow cPython builds also [break lxml compilation](https://github.com/liqd/adhocracy/issues/376).

Wide builds [are available since cPython 2.2](http://www.python.org/dev/peps/pep-0261/). Narrow builds [have been removed in cPython 3.3](http://docs.python.org/dev/whatsnew/3.3.html#pep-393-flexible-string-representation).

A simple check to see whether the installed Python is buggy is verifying that

assert len(u'') == 1

in Python 2.x or

assert len('') == 1

in Python 3.1 and 3.2 does not throw any exceptions. For a version-independent (but not as obvious) test, try

getattr(__builtins__, 'unichr', chr)(120144)