jborean93 / pykrb5

Python krb5 API interface
MIT License
17 stars 8 forks source link

Build failures with Cython 3.0.0b1 #26

Closed mgorny closed 1 year ago

mgorny commented 1 year ago

Cython 3.0.0 has now released beta1 which means we can expect a final release soon. Right now krb5 fails to build with the following errors:

[ 1/20] Cythonizing src/krb5/_creds.pyx

Error compiling Cython file:
------------------------------------------------------------
...
        password_ptr = <const char*>&password[0]

    cdef krb5_prompter_fct callback = NULL
    cdef void *prompt_data = NULL
    if prompter is not None:
        callback = prompt_callback
                   ^
------------------------------------------------------------

src/krb5/_creds.pyx:347:19: Cannot assign type 'krb5_error_code (krb5_context, void *, const char *, const char *, int, krb5_prompt *) except? -1 nogil' to 'krb5_prompter_fct'

Error compiling Cython file:
------------------------------------------------------------
...
        options = k5_gic_options.raw

    cdef krb5_prompter_fct callback = NULL
    cdef void *prompt_data = NULL
    if prompter is not None:
        callback = prompt_callback
                   ^
------------------------------------------------------------

src/krb5/_creds.pyx:420:19: Cannot assign type 'krb5_error_code (krb5_context, void *, const char *, const char *, int, krb5_prompt *) except? -1 nogil' to 'krb5_prompter_fct'
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
    main()
  File "/usr/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
    return hook(config_settings)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/build-env-t82p3njj/lib/python3.11/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=['wheel'])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/build-env-t82p3njj/lib/python3.11/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
    self.run_setup()
  File "/tmp/build-env-t82p3njj/lib/python3.11/site-packages/setuptools/build_meta.py", line 335, in run_setup
    exec(code, locals())
  File "<string>", line 260, in <module>
  File "/tmp/build-env-t82p3njj/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
    cythonize_one(*args)
  File "/tmp/build-env-t82p3njj/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: src/krb5/_creds.pyx

(possibly more)

To force this, I've changed pyproject.toml as following:

diff --git a/pyproject.toml b/pyproject.toml
index 56a013d..648881e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
 [build-system]
 requires = [
-    "Cython >= 0.29.29, < 3.0.0",  # 0.29.29 includes fixes for Python 3.11
+    "Cython >= 3.0.0b1",  # 0.29.29 includes fixes for Python 3.11
     "setuptools >= 42.0.0",  # Supports license_files
 ]
 build-backend = "setuptools.build_meta"