pyproj
pyproj copied to clipboard
A question about pyproj/_datadir.pyx
performance hint: pyproj/_datadir.pyx:80:5: Exception check on 'pyproj_log_function' will always require the GIL to be acquired. Possible solutions: 1. Declare 'pyproj_log_function' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions. 2. Use an 'int' return type on 'pyproj_log_function' to allow an error code to be returned.
Error compiling Cython file:
------------------------------------------------------------
...
cdef void pyproj_context_initialize(PJ_CONTEXT* context) except *:
"""
Setup the context for pyproj
"""
proj_log_func(context, NULL, pyproj_log_function)
^
------------------------------------------------------------
pyproj/_datadir.pyx:129:33: Cannot assign type 'void (void *, int, const char *) except * nogil' to 'PJ_LOG_FUNCTION' (alias of 'void (*)(void *, int, const char *) noexcept'). Exception values are incompatible. Suggest adding 'noexcept' to the type of 'pyproj_log_function'.
This is my report when I install the sat-bundleadjust. But I find the error. I check the _datadir.pyx and find the 'pyproj_log_function' has been declared as 'noexcept'. WHY the error compiling occur.
The signature of the function is determined by PROJ:
https://github.com/OSGeo/PROJ/blob/356e255022cea47bf242bc9e6345a1e87ab1031d/src/proj.h#L383
https://github.com/pyproj4/pyproj/blob/24a7b7f2f05839761c3a6c23de860948a1a9d0f1/pyproj/proj.pxi#L29
I remember trying to make it use noexcept
and moving on when it didn't work with some things I tried. Feel free to tinker and see if you can get it to work a different way.