zopefoundation / zope.index

Indices for using with catalog like text, field, etc.
Other
10 stars 12 forks source link

C compilation warnings under 3.4 and above #14

Closed jamadden closed 7 years ago

jamadden commented 7 years ago

Sadly pip (and tox) hide these by default so they're hard to notice, but if you do python setup.py bdist_wheel you'll see the following compilation warnings:

src/zope/index/text/okascore.c:91:15: warning: implicit declaration of function 'PyInt_AsLong' is invalid in C99 [-Wimplicit-function-declaration]
                f = (double)PyInt_AsLong(PyTuple_GET_ITEM(d_and_f, 1));
                            ^
src/zope/index/text/okascore.c:136:6: warning: implicit declaration of function 'Py_InitModule3' is invalid in C99 [-Wimplicit-function-declaration]
        m = Py_InitModule3("okascore", okascore_functions,
            ^
src/zope/index/text/okascore.c:136:4: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
        m = Py_InitModule3("okascore", okascore_functions,
          ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Presumably we just need to include a header.

jamadden commented 7 years ago

It's worse than I thought. Under Python 3, the C extension is not importable at all:

>>> import zope.index.text.okascore
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/zope.index/.tox/py34/lib/python3.4/site-packages/zope/index/text/okascore.so, 2): Symbol not found: _PyInt_AsLong
  Referenced from: /zope.index/.tox/py34/lib/python3.4/site-packages/zope/index/text/okascore.so
  Expected in: flat namespace
 in //zope.index/.tox/py34/lib/python3.4/site-packages/zope/index/text/okascore.so

But the fallback Python code in okapiindex.py comes into play and so things appear to work.