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

Support PyPy #544

Merged
merged 4 commits into from
Jan 6, 2025
Merged

Support PyPy #544

merged 4 commits into from
Jan 6, 2025

Conversation

skirpichev
Copy link
Contributor

Closes #523

@skirpichev skirpichev marked this pull request as ready for review January 4, 2025 01:41
@skirpichev
Copy link
Contributor Author

I'll mark this as ready for review. However, it requires nightly builds of PyPy (for pypy/pypy#5081), thus - no wheels yet.

Unfortunately, I don't know how to enable cache on PyPy. I don't see anything wrong in the current approach (well, except that we should free cache somewhere in the m_free module method), working for CPython. So, maybe it's a PyPy issue.

Two bugs were discovered. Maybe I should make a separate pr with last three commits?

@casevh
Copy link
Collaborator

casevh commented Jan 4, 2025

Unfortunately, I don't know how to enable cache on PyPy. I don't see anything wrong in the current approach (well, except that we should free cache somewhere in the m_free module method), working for CPython. So, maybe it's a PyPy issue.

Does PyPy optimize the creation of new gmpy2 objects? Maybe the penalty for disabling cache is not severe....

Two bugs were discovered. Maybe I should make a separate pr with last three commits?

A single PR is fine with me.

@skirpichev
Copy link
Contributor Author

Does PyPy optimize the creation of new gmpy2 objects?

I doubt.

Maybe the penalty for disabling cache is not severe.

Maybe. But I don't know, as working with cache is not tested here.

test/test_mpz.py Outdated Show resolved Hide resolved
Docs (for PyBytes_AsString) says: The data must not be modified in any
way, unless the object was just created using
PyBytes_FromStringAndSize(NULL, size).

That's not the case for GMPy_MPFR_To_Binary().  So, PyPy seems to be
right in rejecting modifications.
@casevh casevh merged commit 532970f into aleaxit:master Jan 6, 2025
12 checks passed
@casevh
Copy link
Collaborator

casevh commented Jan 6, 2025

Thanks,

@skirpichev skirpichev deleted the work-onpypy branch January 6, 2025 06:38
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.

Support PyPy?
3 participants