[issue3092] Wrong unicode size detection in pybench

Marc-Andre Lemburg report at bugs.python.org
Thu Jun 12 23:41:33 CEST 2008


Marc-Andre Lemburg <mal at egenix.com> added the comment:

On 2008-06-12 22:58, Antoine Pitrou wrote:
> Antoine Pitrou <pitrou at free.fr> added the comment:
> 
> Le jeudi 12 juin 2008 à 20:26 +0000, Marc-Andre Lemburg a écrit :
>> Doesn't chr(100000) raise an exception in UCS2 builds ?
> 
> No, it returns a 2-character string.

Interesting... I wonder how applications will deal with this. They'd
normally expect to get a length 1 string from chr() or unichr().

I think chr() should only behave in this way if given an option.
Otherwise, it will definitely introduce hard to find bugs in
ported applications (and probably even in newly written ones).

Something like chr(x, surrogates=True) to enable returning
2 code points instead of raising an exception.

>> Note that sys.maxunicode is not available in Python 2.1
>> which is why I chose try-except approach.
> 
> I understand, but is the py3k version of pybench still
> compatible with Python 2.1?

You're right: probably not. Would be great to have the test on the
Py2.x version as well - to see the difference in performance.

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jun 12 2008)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2008-07-07: EuroPython 2008, Vilnius, Lithuania            24 days to go

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::

    eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
     D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
            Registered at Amtsgericht Duesseldorf: HRB 46611

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3092>
_______________________________________


More information about the Python-bugs-list mailing list