Python 3.14 by filmor · Pull Request #2611 · pythonnet/pythonnet

@filmor mentioned this pull request

Oct 7, 2025

@filmor filmor marked this pull request as ready for review

December 8, 2025 10:29

@filmor

@filmor

@filmor

@filmor

@filmor

@filmor

@filmor

@filmor

@filmor

---
updated-dependencies:
- dependency-name: NUnit3TestAdapter
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: NUnit3TestAdapter
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

@filmor

@filmor

@filmor

@filmor

@filmor

@filmor

@filmor

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

@filmor

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.

@filmor

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

@filmor

@filmor

@filmor