[Python-Dev] C extension import time

Nick Coghlan ncoghlan at gmail.com
Sat Oct 12 01:11:21 CEST 2013


On 12 Oct 2013 05:49, "Eric Snow" <ericsnowcurrently at gmail.com> wrote:
>
> On Fri, Oct 11, 2013 at 1:41 PM, Stefan Krah <stefan at bytereef.org> wrote:
> > Antoine Pitrou <solipsis at pitrou.net> wrote:
> >> Just create a _pydecimal module (like _pyio).
> >
> > That's very fast indeed. There's one minor problem: For backwards
compatibility
> > and pickling [1] I'd need to add
> >
> >     __module__ = 'decimal'
> >
> > to every class of the Python version. Are there any reasons not to do
that?
>
> Try just putting "__name__ = 'decimal'" at the top of the source file.

In this case the fixup needs to be conditional on the absence of
"_decimal". Aside from that, yes, lying about name is the easiest way to
preserve pickle compatibility while still moving code around.

Cheers,
Nick.

>
> -eric
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
https://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/20131012/4e7d129c/attachment.html>


More information about the Python-Dev mailing list