• Kirill Smelkov's avatar
    Fix build for Python 3.5 · e6beab19
    Kirill Smelkov authored
    @kazuhiko reports that wendelin.core build is currently broken on Python 3.5.
    Indeed it was:
    
        In file included from bigfile/_bigfile.c:37:0:
        ./include/wendelin/compat_py2.h: In function ‘_PyThreadState_UncheckedGetx’:
        ./include/wendelin/compat_py2.h:66:28: warning: implicit declaration of function ‘_Py_atomic_load_relaxed’ [-Wimplicit-function-declaration]
             return (PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current);
                                    ^
        ./include/wendelin/compat_py2.h:66:53: error: ‘_PyThreadState_Current’ undeclared (first use in this function)
             return (PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current);
                                                             ^
        ./include/wendelin/compat_py2.h:66:53: note: each undeclared identifier is reported only once for each function it appears in
        ./include/wendelin/compat_py2.h:67:1: warning: control reaches end of non-void function [-Wreturn-type]
         }
         ^
    
    The story here is that in 3.5 they decided to remove direct access to
    _PyThreadState_Current and atomic implementations - because that might
    semantically conflict with other headers implementing atomics - and
    provide only access by function.
    
    Starting from Python 3.5.2rc1 the function to get current thread state
    without asserting it is !NULL - _PyThreadState_UncheckedGet() - was added:
    
        https://github.com/python/cpython/commit/df858591
    
    so for those python versions we can directly use it.
    
    After the fix wendelin.core tox tests pass under all python2.7, python3.4 and python3.5.
    
    More context here:
    
        https://bugs.python.org/issue26154
        https://bugs.python.org/issue25150
    
    Fixes: nexedi/wendelin.core#1
    e6beab19
tox.ini 1.15 KB