GeezerVison is showing github.com — Runtime fixes for pyrevit.forms under CPython (pyRevit #3846) by romangolev · Pull Request #4 · pyrevitlabs/pythonnet
Conversation
romangolev
commented
Nov 3, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Review PR for the pythonnet changes behind pyrevitlabs/pyRevit#3846 (pyrevit.forms under CPython).
pyRevit 7.0.1 pins this fork at f591d92 (the base branch, pyrevit-7). pyrevitlabs/pyRevit#3846 moves the dev/modules/pyRevitLabs.Python.Net submodule to 173f533 and updates the PythonNet DLLs in dev/libs. These 13 commits were pushed straight to pyrevit-5-main, which already contains them; this PR exists so they can be reviewed and linked from pyrevitlabs/pyRevit#3846.
Changes
Derived CLR types
- Generated subclass types are cached, keyed on their explicit CLR members and full shape, so redefining a Python class (script reloads) reuses a matching type instead of failing; derived types keep their names.
- Interface-only Python classes get a derived managed type and no longer need
__namespace__; interface types are keyed by defining file.
- Inherited interface members are implemented on derived types.
- Class-creation hooks (
__set_name__, __init_subclass__) run for derived types.
Conversions
- Python truthiness converts to
bool targets.
- Python
object maps to System.Object as a generic argument.
- Disposable CLR objects work as context managers (
with).
Codecs
- Codecs registered after the first conversion take effect.
- Codecs are queried outside the registry lock.
Tests
- CLR class redefinition is covered, with a fixture for it.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Redefinitions that change clrmethod or clrproperty members get a fresh
type, and Reset() clears the cache.
Types keep __namespace__.Name so they stay importable; only a differing shape gets a hash suffix.
Interface-only classes fall back to a plain type if generation fails, so imports never break.
A codec that runs Python could deadlock against a thread holding the GIL.
cached_property works, and same-named classes from different scripts no longer share a type.
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.