Skip to content

Commit

Permalink
BUG: Cython 3 compatibility fixes (pyproj4#1322)
Browse files Browse the repository at this point in the history
  • Loading branch information
snowman2 authored and jbronn committed Jul 24, 2023
1 parent 32565dd commit 58ca72d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 4 additions & 0 deletions docs/history.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Change Log
==========

3.6.0.post1
-----------
- BUG: Cython 3 compatibility fixes (issue #1321)

3.6.0
------
- DEP: Minimum supported Python version 3.9 (issue #1111)
Expand Down
4 changes: 2 additions & 2 deletions pyproj/_datadir.pxd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include "proj.pxi"

cpdef str _get_proj_error()
cpdef void _clear_proj_error()
cpdef str _get_proj_error() noexcept
cpdef void _clear_proj_error() noexcept
cdef PJ_CONTEXT* PYPROJ_GLOBAL_CONTEXT
cdef PJ_CONTEXT* pyproj_context_create() except *
cdef void pyproj_context_destroy(PJ_CONTEXT* context) except *
7 changes: 3 additions & 4 deletions pyproj/_datadir.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ from libc.stdlib cimport free, malloc

from pyproj._compat cimport cstrencode

from pyproj.exceptions import DataDirError
from pyproj.utils import strtobool

# for logging the internal PROJ messages
Expand Down Expand Up @@ -79,22 +78,22 @@ def get_user_data_dir(create=False):
)


cpdef str _get_proj_error():
cpdef str _get_proj_error() noexcept:
"""
Get the internal PROJ error message. Returns None if no error was set.
"""
return _INTERNAL_PROJ_ERROR


cpdef void _clear_proj_error():
cpdef void _clear_proj_error() noexcept:
"""
Clear the internal PROJ error message.
"""
global _INTERNAL_PROJ_ERROR
_INTERNAL_PROJ_ERROR = None


cdef void pyproj_log_function(void *user_data, int level, const char *error_msg) nogil:
cdef void pyproj_log_function(void *user_data, int level, const char *error_msg) nogil noexcept:
"""
Log function for catching PROJ errors.
"""
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=61.0.0", "wheel", "cython>=0.28.4"]
requires = ["setuptools>=61.0.0", "wheel", "cython>=3"]
build-backend = "setuptools.build_meta"

[project]
Expand Down

0 comments on commit 58ca72d

Please sign in to comment.