Also find correct column width of wide characters

Martin Geisler mg at daimi.au.dk
Wed Jan 21 05:16:47 CST 2009


Shun-ichi GOTO <shunichi.goto at gmail.com> writes:

> 2009/1/21 Martin Geisler <mg at daimi.au.dk>:
>> east_asian_width was introduced in Python 2.4 -- is that why you
>> have wrapped the code in a try-except clause? If so, would it not
>> be more explicit do a hasattr(unicodedata, 'east_asian_width')
>> test?
>
> Ah, you are right. I missed python 2.3 has unicodedata (without CJK
> codecs).
>
>> I've just tested this with Python 2.3 and 2.4 and it works fine
>> with the demandimport system, i.e., the module is loaded at that
>> point.
>
> Please post your patch if you can.
> My one can be discarded.

I didn't make a patch -- I just tried did this to test:

% python2.3
Python 2.3.5 (#2, Oct 16 2006, 19:19:48) 
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from mercurial import demandimport
>>> demandimport.enable()
>>> import unicodedata
>>> hasattr(unicodedata, 'east_asian_width')
False

So it's probably easiest if you report your patch.

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.


More information about the Mercurial-devel mailing list