This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lemburg
Recipients amaury.forgeotdarc, belopolsky, brett.cannon, brian.curtin, daniel.urban, lemburg, r.david.murray, techtonik, vstinner
Date 2010-06-17.14:31:33
SpamBayes Score 0.00101943
Marked as misclassified No
Message-id <>
In-reply-to <>
Alexander Belopolsky wrote:
> Alexander Belopolsky <> added the comment:
> I would like to move this forward.  The PyPy implementation at
> claims to be based on the original CPython datetime implementation from the time when datetime was a python module.  I looked through the code and it seems to be very similar to datetime.c.  Some docstings and comments are literal copies.  I think it will not be hard to port that to 3.x.
> I have a few questions, though.
> 1. I remember seeing python-dev discussion that concluded that the best way to distribute parallel C and Python implementations was to have with the following:
> # pure python implementation
> def foo():
>     pass
> def bar():
>     pass
> # ..
> try:
>     from _module import *
> except ImportError:
>     pass
> Is this still the state of the art?  What about parsing overhead?

That approached was used for modules where the C bits replaced the Python
ones. The Python bites were then typically removed altogether.

To avoid the wasted memory and import time, it's better to use:

    from _cmodule import *
except ImportError:
    from _pymodule import *

> 2. Is there a standard mechanism to ensure that unitests run both python and C code?  I believe sys.module['_module'] = None will prevent importing _module.  Is there direct regrtest support for this?

Why not import the two modules directly ?

import _cmodule as module
import _pymodule as module
Date User Action Args
2010-06-17 14:31:35lemburgsetrecipients: + lemburg, brett.cannon, amaury.forgeotdarc, belopolsky, vstinner, techtonik, r.david.murray, brian.curtin, daniel.urban
2010-06-17 14:31:33lemburglinkissue7989 messages
2010-06-17 14:31:33lemburgcreate