Re: [Python-Dev] Sharing functions between C extension modules in stdlib

2010-06-16 Thread Alexander Belopolsky
On Mon, Jun 14, 2010 at 7:09 PM, "Martin v. Löwis" wrote: .. > So it's clearly intentional. I doubt its desirable, though. If only > __PyTime_DoubleToTimet needs to be duplicated, I'd rather put that > function into a separate C file that gets included twice, instead of > including the full timemo

Re: [Python-Dev] Sharing functions between C extension modules in stdlib

2010-06-14 Thread Martin v. Löwis
$ nm build/lib.macosx-10.4-x86_64-3.2-pydebug/datetime.so | grep _PyTime_DoubleToTimet f4e2 T __PyTime_DoubleToTimet $ nm build/lib.macosx-10.4-x86_64-3.2-pydebug/time.so | grep _PyTime_DoubleToTimet 0996 T __PyTime_DoubleToTimet I have two questions: 1) how does this happ

Re: [Python-Dev] Sharing functions between C extension modules in stdlib

2010-06-14 Thread Alexander Belopolsky
On Mon, Jun 14, 2010 at 6:45 PM, Alexander Belopolsky wrote: .. > I did not expect this to work, but apparently the build machinery > somehow knows how to place _PyTime_DoubleToTimet code in both time.so > and datetime.so: .. > I have two questions: 1) how does this happen; and 2) is this intentio

[Python-Dev] Sharing functions between C extension modules in stdlib

2010-06-14 Thread Alexander Belopolsky
I have learned a long time ago that it is not enough to simply declare a function in some header file if you want to define it in one module and use in another. You have to use what now is known as PyCapsule - an array of pointers to C functions wrapped in a Python object. However, while navigatin