Wrong unichr docstring in 2.7

Dave Angel davea at ieee.org
Sun Aug 22 06:39:35 EDT 2010


jmfauth wrote:
> I think there is a small point here.
>
>   
>>>> sys.version
>>>>         
> 2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)]
>   
>>>> print unichr.__doc__
>>>>         
> unichr(i) -> Unicode character
>
> Return a Unicode string of one character with ordinal i; 0 <= i <=
> 0x10ffff.
>   
>>>> # but
>>>> unichr(0x10fff)
>>>>         
> Traceback (most recent call last):
>   File "<psi last command>", line 1, in <module>
> ValueError: unichr() arg not in range(0x10000) (narrow Python
> build)
>
> Note:
>
> I find
> 0x0 <= i <= 0xffff
> more logical than
> 0 <= i <= 0xffff
>
> (orange-apple comparaison)
>
> Ditto, for Python 2.6.5
>
> Regards,
> jmf
>
>
>   
There are two variants that CPython can be compiled for, 16 bit Unicode 
and 32 bit.  By default, the Windows implementation uses 16 bits, and 
the Linux one uses 32.  I believe you can rebuild your version if you 
have access to an appropriate version MSC compiler, but I haven't any 
direct experience.

At any rate, the bug here is that the docstring doesn't get patched to 
match the compile switches for your particular  build of CPython.

DaveA




More information about the Python-list mailing list