[Python-Dev] Unicode exception indexing

Nick Coghlan ncoghlan at gmail.com
Thu Nov 3 23:24:44 CET 2011

Your approach (doing the right thing for both Python and C, new API to
avoid the C performance problem) sounds good to me.

Nick Coghlan (via Gmail on Android, so likely to be more terse than usual)
On Nov 4, 2011 7:58 AM, Martin v. Löwis <martin at v.loewis.de> wrote:

> > I started such hack for the UTF-8 codec... It is really tricky, we
> should not
> > do that!
> With the proper encapsulation, it's not that tricky. I have written
> functions PyUnicode_IndexToWCharIndex and PyUnicode_WCharIndexToIndex,
> and PyUnicodeEncodeError_GetStart and friends would use that function.
> I'd also need new functions PyUnicodeEncodeError_GetStartIndex to access
> the "true" start field.
> >> That would be expensive to compute
> >
> > Yeah, O(n) should be avoided when is it possible.
> Ok. I'll wait half a day or so for people to reconsider (now knowing
> that it's actually feasible to be fully backwards compatible); if nobody
> speaks up, I go ahead and accept the breakage.
> Regards,
> Martin
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20111104/50e3e408/attachment.html>

More information about the Python-Dev mailing list