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

Update Python package to support Python 3.12 #2979

Merged
merged 4 commits into from
Nov 11, 2023

Conversation

d-torrance
Copy link
Member

From gmpy2 2.2.0a1


This should fix the compilation errors we're getting with Python 3.12 (like this one). I've been getting strange segfaults with Python 3.12 in Debian unstable, but I'm curious what happens with the GitHub builds...

@d-torrance d-torrance marked this pull request as draft November 5, 2023 12:25
@d-torrance
Copy link
Member Author

Converting this to a draft until I figure out the segfault issue.

@d-torrance
Copy link
Member Author

I think what was happening is that with Python 3.12, some various thread-related things that Macaulay2 was doing was monkeying around with Python's thread-related things that were set up with Py_Initialize. So we move this from M2 startup to after the Python package is loaded, and now no more segfaults! This makes sense anyway -- what's the point of initializing Python unless you're actually going to use it?

@d-torrance d-torrance marked this pull request as ready for review November 7, 2023 02:31
@d-torrance d-torrance changed the title Update GMP <-> Python conversion routines for Python 3.12 support Update Python package to support Python 3.12 Nov 7, 2023
Two reasons:

* Why initialize Python if we're not going to use it?  This is
  probably true over 99% of the time.

* With Python 3.12, something in the M2 startup was messing with
  Python's threads ("failed to read thread state" errors when running
  the "pythonMain" function and segfaults doing pretty much anything
  else).  Waiting until all that is finished fixes this.
@DanGrayson DanGrayson merged commit 88a60e1 into Macaulay2:development Nov 11, 2023
6 checks passed
@d-torrance d-torrance deleted the python branch December 1, 2023 02:48
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