-
Notifications
You must be signed in to change notification settings - Fork 767
Python 3.14 #2611
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
base: master
Are you sure you want to change the base?
Python 3.14 #2611
Conversation
|
Some subjective feedback from my Windows machine with VS 2022:
|
|
Also had to replace the target framework from net6.0 to net8.0. Also some feedback for .net 8:
And now getting an access memory violation for PyGC_Collect(); in Runtime.cs |
|
Status report: After applying the alignment "fix" (thanks!), things work for the most part. There are some crashes in explicit garbage collection, so I have disabled those tests for now. |
|
Also, we currently apparently have a weird inheritance order for our meta type, which leads to it using the |
|
@filmor As the CI seems to be pretty broken ( Things not clear to me:
Thanks ;-) |
|
There you go. There are still pending issues with the embedding tests that are being worked on in #2638, but I'd be fine with releasing a wheel if we get to the point that all Python tests run through without crashes on 3.14. |
This comment has been minimized.
This comment has been minimized.
|
This is the issue that we run into with the |
|
@lostmsu Please have a look. It will require quite a bit more work to get everything green again (CI-wise, in particular around the embedding), but with these changes, we should be able to release a wheel for Python 3.14. |
027eb12 to
7ca54ff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, minor comments only.
I noticed a few files have been reformatted (whitespace only). Perhaps undo that. Technically all reformatting should be in separate commits mentioned in .git-blame-ignore-revs
.github/workflows/main.yml
Outdated
| - name: Embedding tests (.NET Core) | ||
| run: dotnet test --runtime any-${{ matrix.os.platform }} --framework net8.0 --logger "console;verbosity=detailed" src/embed_tests/ | ||
| if: always() | ||
| if: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we limit the skip to 3.14?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a leftover, will reactivate the tests today.
47378be to
3af5779
Compare
Not at all sure why this helps, but when assigning `None` instead, the object is gone at the time of garbage collection.
- The first two run into issues because our meta type's `tp_getattro` is not overridden by its subclasses - The last runs into a `PyErrOccurred` when trying to access its `__len__`, related to our sequence decoding logic
In Python 3.14, the objects __dict__ seems to already be half deconstructed, leading to crashes during garbage collection. Since gc in Python is single-threaded (I think :)), it should be fine to have a single static for this. If that is not true, we can always use a thread-local instead.
Python 3.14 introduced a new assertion that prevents us from using PyObject_GenericSetAttr directly in our meta type. To work around this, we manipulate the type dict directly. This workaround is a simplified variant of Cython's workaround from cython/cython#6325. The relevant Python change is in python/cpython#118454
Main changes:
ht_token2533df1 (can also skip this, was a red herring)tp_clearworkaround for subtype_clear can not be called from derived types python/cpython#89429 to .NET (4403d4f)PyObject_GenericSetAttrblocking in Python 3.14 (9472f7d)TODO:
tp_setattroinstead of the generic one