[Python-Dev] Sharing functions between C extension modules in stdlib (original) (raw)

Alexander Belopolsky alexander.belopolsky at gmail.com
Tue Jun 15 01:00:19 CEST 2010


On Mon, Jun 14, 2010 at 6:45 PM, Alexander Belopolsky <alexander.belopolsky at gmail.com> wrote: ..

I did not expect this to work, but apparently the build machinery somehow knows how to place PyTimeDoubleToTimet code in both time.so and datetime.so: .. I have two questions: 1) how does this happen; and 2) is this intentional?

OK, the answer to the first question is simple: in setup.py, we have

    exts.append( Extension('datetime', ['datetimemodule.c', 'timemodule.c'],
                           libraries=math_libs) )

but if timemodule.c is compiled-in with datetime module, why is does it also need to be imported to share some other code?



More information about the Python-Dev mailing list