Skip to content

Runtime fixes for pyrevit.forms under CPython (pyRevit #3846) - #4

Draft
romangolev wants to merge 14 commits into
pyrevit-7from
pyrevit-7-cpython-forms
Draft

romangolev wants to merge 14 commits into
pyrevit-7from
pyrevit-7-cpython-forms

Conversation

@romangolev

@romangolev romangolev commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

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.

This branch has not been deployed

No deployments
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.

1 participant