Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prerelease testing for CPython 3.13 to CI #119

Merged
merged 11 commits into from
Feb 3, 2024

Conversation

oscarbenjamin
Copy link
Collaborator

Add prerelease testing for CPython 3.13 to CI

It would also be good to add a job that builds flint from git trunk...

@oscarbenjamin
Copy link
Collaborator Author

Looks like building against flint main fails for fmpz_mod_mat:

src/flint/types/fmpz_mod_mat.c:4860:5: error: too few arguments to function ‘fmpz_mod_mat_clear’
       4860 |     fmpz_mod_mat_clear(__pyx_v_self->val);
            |     ^~~~~~~~~~~~~~~~~~
      In file included from src/flint/types/fmpz_mod_mat.c:1227:
      /usr/local/include/flint/fmpz_mod_mat.h:48:6: note: declared here
         48 | void fmpz_mod_mat_clear(fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx);
            |      ^~~~~~~~~~~~~~~~~~

Maybe there are incompatible changes to the signatures of functions that operate with fmpz_mod_mat...

@oscarbenjamin
Copy link
Collaborator Author

Looks like this was changed in flintlib/flint#1754

@fredrik-johansson
Copy link
Collaborator

fredrik-johansson commented Feb 3, 2024

Looks like this was changed in flintlib/flint#1754

Yes, this will be a notable compatibility-breaking change in 3.1 (unfortunate but badly needed to make things consistent internally). There could be others, but hopefully nothing as major.

@oscarbenjamin
Copy link
Collaborator Author

I don't think it would be hard to change the fmpz_mod_mat code in python-flint for the change. Attempting to support both versions of Flint is possibly awkward but perhaps this is a good moment to see how well an #ifdef approach can work.

@oscarbenjamin
Copy link
Collaborator Author

oscarbenjamin commented Feb 3, 2024

The python-flint fmpz_mod_mat type already stores a reference to an associated fmpz_mod_ctx. If I understand correctly the change is mostly just that almost all fmpz_mod_mat functions in flint now need this ctx to be passed explicitly as an additional parameter.

We can probably do something like:

# fmpz_mod_mat.pxd
cdef extern from *:
    """
    /*
     * fmpz_mod_mat function signatures were changed in flint 3.1.0
    */
    #if __FLINT_RELEASE >= 30100
    void fmpz_mod_mat_clear_compat(fmpz_mod_mat_t mat, fmpz_mod_ctx_t ctx) {
        fmpz_mod_mat_clear(mat, ctx);
    }
    #else
    void fmpz_mod_mat_clear_compat(fmpz_mod_mat_t mat, fmpz_mod_ctx_t ctx) {
        fmpz_mod_mat_clear(mat);
    }
    #endif
    """

cdef extern from "flint/fmpz_mod_mat.h":
    void fmpz_mod_mat_clear_compat(fmpz_mod_mat_t mat, fmpz_mod_ctx_t ctx)

# fmpz_mod_mat.pyx
cdef class fmpz_mod_mat:
    ...
    def __dealloc__(self):
        fmpz_mod_mat_clear_compat(self.mat, self.ctx)

This is needed to support both Flint 3.1.0 at the same time as earlier
versions since the signatures of most fmpz_mod_mat functions are changed
in Flint 3.1.0.
@oscarbenjamin
Copy link
Collaborator Author

Okay, all sorted and works with latest Flint from git as well as previous versions.

@oscarbenjamin oscarbenjamin merged commit 30e71dc into flintlib:master Feb 3, 2024
26 checks passed
@oscarbenjamin oscarbenjamin deleted the pr_py313 branch February 3, 2024 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants