Does __Pyx_ImportType need to check struct sizes? (Cython-relevant, too)
Robert Kern <[email protected]> Sat, 23 May 2009 19:26:38 -0500
| Newsgroups | gmane.comp.python.pyrex |
|---|---|
| Organization | The Church of Last Thursday |
| Message-ID | <[email protected]> |
What is the reasoning behind having __Pyx_ImportType check that the imported type's size at runtime matches exactly the type's size at compile time? This interferes with the ability to expand a type in an otherwise binary compatible way by adding members to the end of the struct. This is causing me some pain as I am adding things to a type in numpy. All of the other extension module binaries built against the older numpy work with the new build of numpy, but the Pyrex-built ones don't because of this explicit check. Cython has the same code. Can this check be changed from "runtime_size!=compiled_size" to "runtime_size>=compiled_size" or be gotten rid of altogether? Checking for a change in the size of the struct is always an imperfect check for binary incompatibility. Even >= will have false negatives, but at least it does not have this particular false positive. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco